30 Apr 2021
02:58 AM
- last edited on
27 May 2021
12:44 AM
by
MaciejNeumann
I am using OneAgent monitoring configuration API to enable/disable Full Stack monitoring but getting below in valid input error.
JSON
Failed. The input is invalid
{
"error": {
"constraintViolations": [
{
"parameterLocation": "PATH",
"location": "string",
"message": "string",
"path": "string"
}
],
"message": "string",
"code": 0
}
}
Solved! Go to Solution.
Hi Naveen,
The Host ID appears in the body of the GET request. But for the PUT, it is only needed on the path. The JSON should only contain monitoringEnabled and monitoringMode.
An example cURL request will look something like:
curl -X PUT "https://{tenant-ID}.live.dynatrace.com/api/config/v1/hosts/HOST-ID12345/monitoring" -H "accept: */*" -H "Authorization: Api-Token {token-value}" -H "Content-Type: application/json; charset=utf-8" -d "{\"monitoringEnabled\":true,\"monitoringMode\":\"FULL_STACK\"}"
Since the Dynatrace Help topic for API doesn't really make it clear, instead I recommend you use the in-product REST API reference (SwaggerUI specification) since you can also "try out" the API PUT requests on the live environment and get the correct specification.
The URL will look like: https://{YOUR-ENVIRONMENT-ID}.live.dynatrace.com/rest-api-doc/index.jsp?urls.primaryName=Configuration%20API#/
Thanks The_AM working fine.