cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
968
Views
2
Helpful
3
Replies

Umbrella Cloud Security API - Add Destinations to Destination List

stipend
Level 1
Level 1

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:

stipend_0-1677096604803.png

 

{
"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?

1 Accepted Solution

Accepted Solutions

Sam Baggins
Level 1
Level 1

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)

View solution in original post

3 Replies 3

What's your body look like? That's the data being inserted.

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. 

 

stipend_0-1677098024509.png

 

Sam Baggins
Level 1
Level 1

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)