02-22-2023 12:11 PM
I'm trying to use this API: https://developer.cisco.com/docs/cloud-security/#!add-destinations-to-destination-list
But I keep getting a "400 Bad Request" response and I cannot figure out why. Below is what I'm trying:
{
"statusCode": 400,
"error": "Bad Request",
"message": "Not a valid destination list. It should be array of destination objects",
"txId": "175f7a0bc88y"
}
Can someone please let me know what I'm doing wrong?
Solved! Go to Solution.
08-04-2023 11:43 AM - edited 08-04-2023 02:16 PM
I get this response using the following python code:
mydata = "destination:reddit.com"
postresponse = requests.post("https://api.umbrella.com/policies/v2/destinationlists/REDACTED/destinations", headers = myheaders, data = json.dumps(mydata))
edit: I have resolved my error by modifying my code as below (note the square AND curly brackets):
mydata = [{"destination":"reddit.com"}]
postresponse = requests.post("https://api.umbrella.com/policies/v2/destinationlists/REDACTED/destinations", headers = myheaders, json=mydata)
02-22-2023 12:23 PM
02-22-2023 12:34 PM
Well, thats the thing. I'm not sure what the body is supposed to look like. They gave an example of the request body. I tried mimicking the query parameters to what they show in the schema definition (see screenshot in the original post). I tried mimicking the example body but I'm lost on what its looking for.
08-04-2023 11:43 AM - edited 08-04-2023 02:16 PM
I get this response using the following python code:
mydata = "destination:reddit.com"
postresponse = requests.post("https://api.umbrella.com/policies/v2/destinationlists/REDACTED/destinations", headers = myheaders, data = json.dumps(mydata))
edit: I have resolved my error by modifying my code as below (note the square AND curly brackets):
mydata = [{"destination":"reddit.com"}]
postresponse = requests.post("https://api.umbrella.com/policies/v2/destinationlists/REDACTED/destinations", headers = myheaders, json=mydata)
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide