POST error or route error?

works in Postman, not from notecard.
{“req”:“web.post”,“route”:“Polar”,“body”:{“temperature”:“25”}}
or
{“req”:“web.post”,“route”:“Polar”,“body”:{“temperature”:25}}
error is:
{“err”:“hub request error: invalid character ‘h’ after object key:value pair”}

If I go to a different route, I get a POST (the 400 is what I expect).

{“req”:“web.post”,“route”:“lp-iLevel”,“body”:{“temperature”:“25”}}
{
“body”: {
“Message”: “Unspecified or invalid Uuid”
},
“result”: 400
}

Hi @Poem,

I’m not sure if this is the issue or not, but your code sample includes smart double-quotes which isn’t valid JSON. (May have just been a copy-paste formatting issue though.) Can you try with regular double quotes or single quotes?

{
	"req": "web.post",
	"route": "Polar ",
	"body ": {
		"temperature ": 25
	}
}

Nope:

{“req”: “web.post”,“route”: “Polar”,"body ": {“temperature”: 25}}
{“err”:“hub request error: invalid character ‘h’ after object key:value pair”}

The smart quotes are from the paste into this box. The POST returning the 400 made it round-trip.

Hey @poem, can you confirm that the endpoint you are accessing returns JSON as the content-type? That error from the Notecard looks like a parse error, which would suggest the return content-type is not valid JSON.

Using Postman to post {“temperature”:25} returns:
“‘payload’”
which is valid json
However, header indicates Content-Type:text/html
is that the problem?

I believe so, yes. It’s the content-type that matters here. Is this an endpoint you control? Can you change the content-type and try again?

Yep… looks like a server problem. If I post as json rather than text I throw an error. Thanks

1 Like