What Content-Types are available to when importing data with the Domo DataSet API?

I am in the process of creating a Python script that will make a call to an API and take that data and import it to Domo. I've been able to authenticate with the Domo API and make a new dataset in Domo and grab the dataset ID but when I'm trying to import data into the dataset I'm running into issues. 

 

The documentation only gives the example of Content-Type: text/csv. 

 

  • Are there any other methods of importing data (json or xml)?
  • If not then what are the csv requirements that are accepted?
    • Do we need to wrap each value in quotes or does that only depend on the datatype?
    • What if my data has commas or quotes built into the data itself, how can I escape those characters?
    • How can I distinguish a new line?

 

I've tried playing around with requests and I found I couldn't import with JSON or XML but wasn't sure if there were other workarounds

 

{"status":400,"statusReason":"Bad Request","message":"Content type \'application/xml\' not supported","toe":"DULVTGRT2R-1QKE9-6ABP9"}
{"status":400,"statusReason":"Bad Request","message":"Content type \'application/json\' not supported","toe":"8Q8KM5BPBV-641HK-KC40T"}

When I tried putting in a sample CSV it gave me the following so it failed too but my dataset in Domo shows that it is now stuck on the "Storing" phase and has been for an hour.

 

{"status":400,"statusReason":"Bad Request","message":"Underlying service error: Internal Server Error","toe":"43KJK4JK97-GJ665-PLNQ1"}

Any advice or examples would be great! 

 

Resource:

https://developer.domo.com/docs/domo-apis/data#API%20-%20Import%20Data

 

Best Answer

  • btm
    btm
    Answer ✓

    Hi @bcooper,

     

    Sorry for the delay in responding.  We've switched some roles internally and I just saw your post on my radar.

    In answer to your first question, currently CSV is the supported file type for importing.

     

    With CSV, the prescribed format to use for best results is the RFC 4180.

    For best results, it is recommended you wrap in double quotes so that it will help you with your commas that may be found inside your data as documented here.  To distinguish a new line you will need to introduce a line break.

     

    If you are hoping to create an initial dataset and only upload once the import dataset should help, however, if you are needing to continually add more data - we recommend utilizing documentation for our Stream APIs:

     

    Upload Data with Stream APIs

     

    Stream APIs

     

    Let me know if you need further help or guidance.

Answers

  • Thanks for sending that! I was able to figure this out.

     

    If anyone comes across this in the future I am using Python and I have got this to successfully upload by wrapping everything (including decimals and longs) in Double quotes and Domo has been successfully able to put it into the correct datatype based on the datatypes specified when first creating the dataset. 

     

    I also put both a \r and a \n character to specify a newline and it seems to work. 

     

    So, just wrapping everything in quotes regardless of the data type and adding '\r\n' to specify a new row has been working for me. I also did have to switch this to the Stream API for this to work.

     

    Thanks for taking a look at this!

This discussion has been closed.