400 Bad request sending stateId bookmark to learning locker
Nov 17, 2017
Hi,
I'm getting a 400 Bad request error when the course sends a request of activities/state?stateId=bookmark.
This is the request URL: http://localhost:8081/data/xAPI/activities/state?stateId=bookmark&activityId=http%3A%2F%2FhP0xiFLg52evb6dNFBDjsUBGPXjq1wor_rise&agent=%7B%22objectType%22%3A%22Agent%22%2C%22mbox%22%3A%22mailto%3Aandrew%40tincanapi.co.uk%22%2C%22name%22%3A%22Andrew%20Downes%22%7D
And this is the Request payload:
index.html#/lessons/Hk4FP3b27_48GEDusalESaCpY9j4AdUE
And the error I'm getting from Learning Locker is this
SyntaxError: Unexpected token i in JSON at position 0
at Object.parse (native)
at parse (C:\Apps\xapi-service\node_modules\body-parser\lib\types\json.js:89:19)
at C:\Apps\xapi-service\node_modules\body-parser\lib\read.js:121:18
at invokeCallback (C:\Apps\xapi-service\node_modules\raw-body\index.js:224:16)
at done (C:\Apps\xapi-service\node_modules\raw-body\index.js:213:7)
at IncomingMessage.onEnd (C:\Apps\xapi-service\node_modules\raw-body\index.js:273:7)
at emitNone (events.js:86:13)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
I think the error is because Learning Locker expects the payload to be a JSON string but the course is sending this "index.html#/lessons/Hk4FP3b27_48GEDusalESaCpY9j4AdUE" instead.
And from reading from the spec "The TCAPI state API allows you to specify any number of arbitrary key / value pairs for state".
Is there a fix to this kind of issue?
Thanks in advance.
Regards,
Carlos
1 Reply
Hi Carlos. Thanks so much for doing some digging into this issue. I've opened a case for you with our support engineers. You should be getting an email to confirm, and somebody will reach out to you directly! I'll follow along, too.
This discussion is closed. You can start a new discussion or contact Articulate Support.