REST/URL API Query - where to enter?

Hi,

 

I have a JSON API query for our database which is working in Klipfolio and in Postman but I can't work out where to enter the address, headers and body to create a new Domo datasource. I've had a look at workbench and at developer.domo.com and keep getting stuck. I assume this must be a fairly simple thing to do though?

 

We have a custom connector but its only pulling 20 of the 200+ rows for some of the API calls.

 

Thanks,

 

Josh

 

This is a sample of the raw working api call from postman:

 

POST /api/v1/xxx
Host: xxx
Authorization: Bearer xxx
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
Postman-Token: xxx

{
"VendorId":80,
"TimeFrame": "AddMonths(-3)",
"Language": "en-US",
"MetricValue": "launches",
"BreakdownValue": "3",
"StatusValue": "All",
"RunByValue": "RunByAll",
"CountryFilters": [],
"GridVendorCampaignFilters": [],
"GridVendorCampaignPlayLanguageFilters": [],
"SourceFilters": null,
"PartnerFilters": []
}

Best Answer

  • josho909
    josho909 Member
    Answer ✓

    Hi, I solved this through a workaround...

    I created a python script to call the API multiple times and turn the results into .csv's saved on my local HDD. I then used task scheduler to run the .py script daily and used Domo Workbench to import the data daily into Domo. It's been working fine so far although it was a bit of a hassle to setup. Here are the basics of the .py script:

    #API Query
    payload = {
    parameters go here
    }
    #API URL
    url = "https://url goes here"
    #API Authorization key
    headers = {headers go here}

    #Calling the API parsing the json and finally saving as .csv
    jsonname = requests.post(url, data=json.dumps(payload), headers=headers)
    dfname = pd.read_json(jsonname.content)

    dfname.to_csv('C:/file location here',index=False,encoding='utf-8')

Answers

  • Could someone help out with this?

  • Bump,

     

    I have tried escalating this question via the Domo sales reps and have not gotten any response, so I'd really appreciate if anyone can lend a hand.

     

    As I understand it you can make an API call through the JSON advanced connector, but no matter the format of these requests it inevitably fails.

     

    Thanks,

     

    Josh

  • Is there any solution to this, I'm also failing to use the JSON over REST connector

  • josho909
    josho909 Member
    Answer ✓

    Hi, I solved this through a workaround...

    I created a python script to call the API multiple times and turn the results into .csv's saved on my local HDD. I then used task scheduler to run the .py script daily and used Domo Workbench to import the data daily into Domo. It's been working fine so far although it was a bit of a hassle to setup. Here are the basics of the .py script:

    #API Query
    payload = {
    parameters go here
    }
    #API URL
    url = "https://url goes here"
    #API Authorization key
    headers = {headers go here}

    #Calling the API parsing the json and finally saving as .csv
    jsonname = requests.post(url, data=json.dumps(payload), headers=headers)
    dfname = pd.read_json(jsonname.content)

    dfname.to_csv('C:/file location here',index=False,encoding='utf-8')

  • @josho909,

     

    Thanks for your tenacity and persistence on this one. I will bring your solution to the Education team to see if we can make this an official article.

     

    CC: @JeriLarsen @SamHoward

    Regards,