Invalid JSON in REST API Example

Rpierce

Posted on
Jun 26 2015

My understanding is that the use of single quotes and trailing commas in the example (https://raygun.io/raygun-providers/rest-json-api) is invalid JSON. Probably for most folk they wouldn't notice/care/get thrown by it, but for the uninitiated it might be nice if it were technically correct.


Jason Fauchelle

Raygun

Posted on
Jun 26 2015

Hello,

Thanks for your feedback, we certainly want to keep the docs technically correct! I've fixed this up now.

-Jason Fauchelle


Andrew Wellins

Posted on
Sep 20 2017

Hi I've been experimenting with the API at https://api.raygun.io/entries and continue to get a 400 error have add the Api-Key header and set the content-type set to multipart/form

` Raw Post

POST https://api.raygun.io/entries HTTP/1.1

Accept-Encoding: gzip,deflate

Content-Type: multipart/form-data

MIME-Version: 1.0

X-ApiKey: Masked*==

Content-Length: 804

Host: api.raygun.io

Connection: Keep-Alive

User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

== JSON Data

{ "occurredOn": "2017-09-31T23:50:59Z", "details":{"machineName":"MyMachine", "groupingKey":"Testing", "version":"12.0.46", "client":{"name":"TEST", "version":"12.0.46" }, "error":{"innerError":"Broke Bad", "className":"Crappy Class", "message":"It Broke" } ,"breadcrumbs":{"message":"test"} ,"environment":{"osVersion":"Windows 10", "cpu":"Intel64 Family 6 Model 60 Stepping 3, GenuineIntel", "architecture":"x86", "totalPhysicalMemory":0, "availablePhysicalMemory":0, "totalVirtualMemory":0, "availableVirtualMemory":0 } ,"tags":{} ,"userCustomData":{} ,"request":{} ,"user":{} ,"context": {} } }
` I've parsed the JSON it appears to be valid any thoughts to what could be the problem or what the minimum JSON structure that can be sent so I can work backward

TIA

Andrew


Jason Fauchelle

Raygun

Posted on
Sep 20 2017

Hi Andrew,

That JSON data should not be the result of a 400 as it certainly looks valid. You will need to change the breadcrumbs to be an array of objects though to be parsed correctly later down the pipeline - but that won't affect your current issue.

One thing that looks off is the content-type, try using "application/json; charset=utf-8" instead and let us know if you run into any further issues.

Regards -Jason Fauchelle


Reply