No error, but no change when using “Change Dataset Properties” API

I’m running into an issue running the “Change Dataset Properties” API, however. Running the code below should update the dataset name from “DataBricks Product Dataset” to “Databricks Testing”. I get a 200 status back and the response object returns the properties object as expected, but no change takes place either in the application or in the response object. With no error and a 200 response, I’m scratching my head on why nothing updates. I wanted to see if you maybe had any ideas on this. This is the first “PUT” method API call I’ve used with DOMO.
<code>

# Change dataset properties

importrequests

importos

importjson

token=os.environ.get('domo_access_token')

dataset='cc06eb69-e6ed-4ca2-9c42-a12a725368fe'

reqObj= {

  "method": "PUT",

  "url": "https://packsize.domo.com/api/data/v3/datasources/"+dataset+"/properties",

  "headers": {

    "X-DOMO-Developer-Token": token,

    "Content-Type": "application/json"

  },

  "body": {

    "name": "Databricks Testing

}

r=requests.put(reqObj.get("url"), headers=reqObj.get("headers"), json=reqObj.get("body"))

# Format Response

res=r.content

my_json=res.decode('utf8').replace("'", '"')

print(my_json)

data=json.loads(my_json)

s=json.dumps(data, indent=2, sort_keys=True)

print('-'*50)

print(s)
</code>

Tagged:

Answers

  • Since you're usign Python I'd recommend utilizing the pydomo package which has examples on how to rename datasets.

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**