PaloAltoNetworks / pan.dev

Palo Alto Networks for Developers
https://pan.dev
MIT License
41 stars 56 forks source link

Issue/Help with "Update Element for Associations (v3.0)" #757

Open thedrsadvocate opened 1 month ago

thedrsadvocate commented 1 month ago

Documentation link

https://pan.dev/sdwan/api/put-sdwan-v-3-0-api-elements-element-id/

Describe the problem

When passing in the "Required" values in the body (which is only labeled as site_id being required) and passing in the values into the body that I would like to update, I continue to get a "INVALID_JSON_INPUT" "Input JSON does not have all required attributes".

Here is my JSON body I'm trying to pass: { "name":"test-api", "site_id":"############" } (the site_id is filled out with the real values in my API call)

Suggested fix

The documentation should be updated to reflect all of the true required values, as the site_id is clearly not the only one that is required.

thedrsadvocate commented 1 month ago

I've now tested in both Python code and Postman with the same error. The above initial issue is via postman.

I copy/pasted the Python code exactly from the documentation and removed the payload items I do not need to modify. Again, it appears that "site_id" is not the only required element as stated in the docs:

import requests import json

url = "https://api.sase.paloaltonetworks.com/sdwan/v3.1/api/elements/:element_id"

payload = json.dumps({ "name": "string", "site_id": "string", }) headers = { 'Content-Type': 'application/json', 'Accept': 'application/json' }

response = requests.request("PUT", url, headers=headers, data=payload)

I should note that I also have a 'Authorization' in the header as well with my bearer token. I can confirm that GET requests work fine, but PUT is where the issue lies. So I can rule out authentication issues.