18 Aug 2025
09:31 PM
- last edited on
19 Aug 2025
07:46 AM
by
MaciejNeumann
We're working on adding network devices to a snmp monitoring extension (custom unfortunately) via API, and I'm trying to figure out how to resolve this 403 response code. Since there's no built-in snmp monitoring, we're stuck with a custom extension that support can't help with.
Any suggestions on how to figure out this response code? I've copied the payload from the extension page, and we're able to manually add nodes via that page (permissions seem correct). An admin here says that the permissions aren't an issue since I can manually added the device to the extension, though a google search suggests a 403 response code may be related to authorization, authentication, or maybe something security related.
We're just looking to automate device adds via the api--if it's even possible. I'm being told it is, from a high-level.
Note some of the sensitive info is edited out (URL, token, activeGate ID, etc).
import requests
api_token = "abc123"
full_url_node_add = "https://{environmentid}.live.dynatrace.com/api/v2/activeGates/####/autoUpdate/validator"
true = True
false = False
payload = {
"value": {
"enabled": true,
"description": "Cisco -L3 Devices",
"version": "0.0.70",
"featureSets": [
"Health",
"Interfaces",
"BGP",
"Traffic",
"Sensors",
"Interfaces 32-bit",
"Power supply",
"High availability",
"Memory pools",
"Interfaces 64-bit"
],
"vars": {},
"snmp": {
"devices": [
{
"ip": "10.1.1.5",
"port": 161,
"authentication": {
"type": "SNMPv2c",
"community": "abc"
},
"advanced": {
"timeoutSecs": 30,
"retries": 3,
"maxRepetitions": 1,
"maxOidsPerQuery": 20
}
}
]
}
},
"scope": "pre-filled"
}
resp_node_add = requests.post(full_url_node_add, headers={"Authorization": "Api-Token " + api_token}, json=payload, verify=False)
print("\nresp_node_add.status_code: ",resp_node_add.status_code) # check the status code
print("\ntype(resp_node_add): ",type(resp_node_add))# check the type
print("\nraw return: resp_node_add: ",resp_node_add)# check the raw return
resp_node_add.status_code: 403
type(resp_node_add): <class 'requests.models.Response'>
raw return: resp_node_add: <Response [403]>
This is the API POST that seems relevant from what I can figure out:
dynatrace.com/rest-api-doc/index.jsp?urls.primaryName=Environment%20API%20v2#/ActiveGates%20-%20Auto-update%20configuration/validateGlobalAutoUpdateConfigForTenant
Once we get validated responses, I'll likely try the PUT to write the config changes. This is all assuming it's the correct way to do this.