Splunk AppDynamics

Import Health Rule error message - Unexpected character (- (code 45)) in numeric value

Mikel_Osinalde_
Path Finder

Hi everyone,

Has anyone faced the following problem when importing a health rule in JSON format?

I'm using the following curl command:

curl -sL -w "%{http_code}" -X POST --user "${USER}:${PASS}" \
-H "Content-Type: application/json" -F file=@${FILE}.json \
https://$HOST/controller/alerting/rest/v1/applications/$APP_ID/health-rules

which in every JSON file I tried, returns me this error:

{
"statusCode" : 400,
"message" : "Unexpected character (- (code 45)) in numeric value: expected digit (0-9) to follow minus sign, for valid numeric value "
}

... even if I'm using the same JSON as in the official documentation:

https://docs.appdynamics.com/display/PRO45/Health+Rule+API

The JSON files I've tried do not contain any hyphen characters, so apparently the request payload is not related to the error cause.

Anyone been there?

Thanks and regards.

Labels (3)
Tags (2)
0 Karma
1 Solution

Morelz
Motivator

Hi there

Can you share your health rule json file you are trying to import?

Did you build it from scratch, or did you export it, and you are trying to import it again?

The query you should be using is as follows

Need to use --data, not -F File

curl -X POST --user user@user:password "https://<controller details/controller/alerting/rest/v1/applications/<application ID>/health-rules" -H "Content-Type: application/json" --data "@test2.json"

View solution in original post

Morelz
Motivator

Hi there

Can you share your health rule json file you are trying to import?

Did you build it from scratch, or did you export it, and you are trying to import it again?

The query you should be using is as follows

Need to use --data, not -F File

curl -X POST --user user@user:password "https://<controller details/controller/alerting/rest/v1/applications/<application ID>/health-rules" -H "Content-Type: application/json" --data "@test2.json"

Mikel_Osinalde_
Path Finder

Good morning Mario,

Thanks for your tip, once I changed to --data instead of -F file, it worked!!!

Get Updates on the Splunk Community!

Enhance Your Splunk App Development: New Tools & Support

UCC FrameworkAdd-on Builder has been around for quite some time. It helps build Splunk apps faster, but it ...

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...