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
-
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:
Let me know if you need further help or guidance.
1
Answers
-
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:
Let me know if you need further help or guidance.
1 -
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!
1
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 738 Beast Mode
- 58 App Studio
- 40 Variables
- 685 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 47 Workflows
- 10 DomoAI
- 36 Predict
- 15 Jupyter Workspaces
- 21 R & Python Tiles
- 395 Distribute
- 113 Domo Everywhere
- 276 Scheduled Reports
- 6 Software Integrations
- 124 Manage
- 121 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive