AnsweredAssumed Answered

JSON lexical error

Question asked by cdunkake on Jul 30, 2017
Latest reply on Jul 30, 2017 by bigtom

Hi folks,

 

I'm trying to find my mistake for hours, maybe one of you sees it right away...

 

I'm want to connect to the PivotalTracker API (Pivotal Tracker API - Essentials ).

 

Every request that does not require body parameter / is a GET request works great.

E.g. (to get details about a story): PT want

curl -X GET -H "X-TrackerToken: $TOKEN" "https://www.pivotaltracker.com/services/v5/projects/$PROJECT_ID/stories/559"

I give them

and everything is good.

 

Whatever I try a request that actually requires a body end up with a lexical error what ever I try.

PT want e.g.

curl -X POST -H "X-TrackerToken: $TOKEN" -H "Content-Type: application/json" -d '{"current_state":"started","estimate":1,"name":"Exhaust ports are ray shielded   "}'

The body part being

-d '{"current_state":"started","estimate":1,"name":"Exhaust ports are ray shielded   "}'

I always get something like

{"code":"could_not_parse_body","kind":"error","error":"Cannot parse the JSON-encoded request body.","general_problem":"Couldn't parse the content of the request's body.","possible_fix":"The parser returned the following error message:  lexical error: invalid char in json text.\n                                       '{\\\"name\\\":\\\"NEW\n                     (right here) ------^\n"}

 

It seems that the requires "'"s confuse FM since it apparently does escape all the content. But I cannot get rid of the escapes since then the calculation in FM is not accepted.

Any hints?

Outcomes