I came across a gist which returns JSON data https://gist.githubusercontent.com/rdsubhas/ed77e9547d989dabe061/raw/6d7775eaacd9beba826e0541ba391c0da3933878/gnc-js-api
I tried to create one to return JSON data and ended up like this https://gist.github.com/vigneshvdm/862ec5a97bbbe2021b79
How can i create a link like the first one and make it return data in JSON format
Not only are gists free to create and store on GitHub, but they are also easy to create.
The problem is the HTTP response type is text/plain
but you will need application/json
for most clients to handle it properly.
Update: using rawgit.com I was able to get your test working with the correct content-type.
My test Gist: https://gist.githubusercontent.com/anonymous/85dbc2c71023f24c2e26/raw/849848a71a1805a314897f9fe98eb7dc43e2e9b9/gistfile1.json
My RawGit URL: https://rawgit.com/anonymous/85dbc2c71023f24c2e26/raw/849848a71a1805a314897f9fe98eb7dc43e2e9b9/gistfile1.json
Using HTTP GET, sending over:
GET https://rawgit.com/anonymous/85dbc2c71023f24c2e26/raw/849848a71a1805a314897f9fe98eb7dc43e2e9b9/gistfile1.json HTTP/1.1
Accept: application/json
Host: rawgit.com
Receiving back:
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 24 Dec 2014 10:57:07 GMT
Content-Type: application/json
Connection: keep-alive
X-Content-Type-Options: nosniff
X-Robots-Tag: none
RawGit-Naughtiness: 0
Access-Control-Allow-Origin: *
ETag: "0250189db62d31523a5cd0da47449eb4"
Cache-Control: max-age=300
Vary: Accept-Encoding
RawGit-Cache-Status: HIT
Content-Length: 104
[{ Name: "Vignesh", Salary: 30000 },{ Name: "Yuvraj", Salary: 90000 },{ Name: "Nithya", Salary: 87000 }]
And a couple screenshots:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With