Receiving 415 Error when Updating Dataset through API
Hi,
I'm trying to upload some CSV data with Python and I feel like my data is formatted properly but I'm still getting a 415 error. This is what the data looks like and is set to a variable cvList.
"None","Auxiliary Copy","Running","92"
"vmidintrawfe01","Backup","Running","52"
"soepdfs02","Synthetic Full Backup","Running","47"
"None","Auxiliary Copy","Running","13"
"s001apporap01","Synthetic Full Backup","Running","23"
"None","Auxiliary Copy","Running","81"
"None","Auxiliary Copy","Running","97"
I was able to successfully create the dataset in the same script so I know the access_token is correct. This is what I'm using for this section of the code.
def UpdateDataset():
# Put Dataset
# PUT https://api.domo.com/v1/datasets/{DATASET ID}/data
print("Updating Domo Dataset")
try:
response = requests.put(
url="https://api.domo.com/v1/datasets/{DATASET ID}/data",
headers={
"Authorization": access_token,
"Accept": "text/csv",
},
data=cvList,
)
print('Response HTTP Status Code: {status_code}'.format(
status_code=response.status_code))
print('Response HTTP Response Body: {content}'.format(
content=response.content))
except requests.exceptions.RequestException:
print('HTTP Request failed')
Anyone know why I'm seeing this? This is the 2nd dataset with which I'm having this same issue.
Best Answer
-
Okay, I finally figured this out. I needed to add a "Content-Type": "text/csv" to my header because "Accept": "text/csv" was not enough.
0
Answers
-
Just as an update, I also tried sending a single line non-variable string "a,b,c,d" and am still getting that error.
0 -
Okay, I finally figured this out. I needed to add a "Content-Type": "text/csv" to my header because "Accept": "text/csv" was not enough.
0
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