Discussions

 View Only
  • 1.  Currency exchanges / API

    Posted 05-20-2019 11:49
    Hi,

    I am trying to update currency rates on a daily basis with an API from the following endpoint. https://api.exchangerate-api.com/v4/latest/USD">https://api.exchangerate-api.com/v4/latest/USD">https://api.exchangerate-api.com/v4/latest/USD

    I currently have a Table called Currenices -> Exchange rates.
    Each Base currency has its own exchange rate conversion table with multiple records.
    eg.  USD to DKK, USD to SEK etc.. 


    I am currently following this logic,

    1) Creating an http call for each currency in the exchange table by sending a Request to an Endpoint I have created in  Azure cloud which will pass the #record id and currency code.

    2) I then create a new http request from azure logic app to get the updated rates from the endpoint above.

    3)  Then send a new post request back to QB using API_Editrecord with the record id, name and new currency rate.

    Problem is I have to create a new http request for each and every conversion.

    Is there any way I could simplify maybe just create 1 request and then update all my records from this request ?

    Hope you guys can help with any good suggestions





  • 2.  RE: Currency exchanges / API

    Posted 05-20-2019 21:03
    API_ImportFromCSV will let you combine your EditRequests into one call. You build it like it sounds - where the data object is like a CSV file - and as long as you're passing in the RID as one of the data points in each row - you can update the currencies in one go. 

    So depending on how you're handling it in Azure - you'll basically have to map the response from the Currency endpoint and associate each currency with the right Record ID - and the POST the import call back to Quick Base

    Chayce Duncan | Technical Lead
    (720) 739-1406 | chayceduncan@quandarycg.com
    Quandary Knowledge Base


  • 3.  RE: Currency exchanges / API

    Posted 05-21-2019 09:20
    Hi Chayce, 

    Thanks for your responds.
    It sounds like the best way, but I would then have to export the table from QB into Azure in order merge the tables. 

    Which API call would be the best for extracting an entire table into azure ?


    The logic will look something like this: 

    A) Call Currency endpoint & create csv table
    B) Export the QB table to Azure and join with the currency table 
    C) Create post request to QB with the merged table using API_ImportfromCSV


    Best regards
    Shadi





  • 4.  RE: Currency exchanges / API

    Posted 05-21-2019 13:43
    API_DoQuery will extract the data you need. Since you want the entire table, you can just toss in a qid=1 to get the list all for your table - and extract the data set that way. The XML response will have the data you need. 

    Chayce Duncan | Technical Lead
    (720) 739-1406 | chayceduncan@quandarycg.com
    Quandary Knowledge Base