Hi,
when I try to add a new metric point with the API I receive the following error:
{"errors":[{"id":"687302ce-d40e-4ffa-a822-c83c0c33ee94","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["The value format is invalid."]}}]}
My request:
curl --request POST --url https://demo.cachethq.io/api/v1/metrics/1/points --data '{"value":2.50,"timestamp":"2017-03-31 10:50:00"}' -H "X-Cachet-Token: 9yMHsdioQosnyVK4iCVR"
Happens in 2.3.11-dev (your demo), 2.3.10 and 2.4.0-dev, although the error message in 2.4.0-dev is
{"errors":[{"id":"33c0fede-c969-4236-b2bf-15355092fea3","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["The value field is required."]}}]}
Configuration of Metric:
calculation: sum|average
default value: 1
decimal places: 2
threshold: 10
Any ideas?
Well.. it says "The value format is invalid".. so "2.50" is not working.. try "2" or "3" or maybe "2,50" ?
The 2nd request is saying "The value field is required".. so you haven't specified a value there
Hi,
1) doesnt work with natural numbers either, even if passed as string
2) query for all examples is the same, so the value is definitely there
Just run the example from the docs against demo.cachethq.io
Can you verify the same problem on a Live-Setup ? And not on demo.cachethq.io ?
Looks like the site is cloudflare-protected.. maybe there are some issues with their setup
Yeah, also happens on a local installation.
Can you try this on https://dev.cachethq.io as well please?
Sure.
Request:
curl --request POST --url https://dev.cachethq.io/api/v1/metrics/1/points --data '{"value":2.50,"timestamp":"2017-04-24 08:50:00"}' -H "X-Cachet-Token: 9yMHsdioQosnyVK4iCVR"
Response:
{"errors":[{"id":"4eb1da77-7ae8-4194-bd88-886f1039a14d","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["The value field is required."]}}]}
I was having this issue as well. You need to define the content type in the request.
The curl would look like:
curl --request POST --url https://demo.cachethq.io/api/v1/metrics/1/points --data '{"value":2.50,"timestamp":"2017-03-31 10:50:00"}' -H "X-Cachet-Token: 9yMHsdioQosnyVK4iCVR" -H "Content-Type: application/json"
It seems to me that the api requires content-type to be set, but does not raise an error when it is missing.
@richardnbanks by anychance is this issue resolved? as I tried just now and it seems still the error persist as it is even after added Content-Type to it.
Closed why...?
There hasn't been an update in 26 days.
So the issue still exists. Why closing the issue then?
@richardnbanks suggested that it was fixed, without further info what more can I do?
I'm also getting this issue within v2.3.13
Hey guys,
did anyone ever find a solution to this issue?
I'm running Cachet 2.4.0-dev and get the exact same error message on my on-premise installation:
{"errors":[{"id":"c2bb8049-9a2e-465f-b8df-ef1ac07b200d","status":400,"title":"Bad Request","detail":"The request cannot be fulfilled due to bad syntax.","meta":{"details":["The value field is required."]}}]}
I've tried it with and without the Content-Type.
Cheers!
Max
Most helpful comment
I was having this issue as well. You need to define the content type in the request.
The curl would look like:
curl --request POST --url https://demo.cachethq.io/api/v1/metrics/1/points --data '{"value":2.50,"timestamp":"2017-03-31 10:50:00"}' -H "X-Cachet-Token: 9yMHsdioQosnyVK4iCVR" -H "Content-Type: application/json"It seems to me that the api requires content-type to be set, but does not raise an error when it is missing.