My favourite tool for working with APIs is curl, though I recognise that lots of people like HTTPie and seem very keen to tell about it every time I mention curl… With curl, I particularly like using the -i switch to view the status line and headers too without the additional cruft of -v: This generates an output that looks like this:
|
$ curl -i https://api.joind.in HTTP/1.1 200 OK Date: Wed, 04 Oct 2017 09:51:46 GMT Server: Apache X-Powered-By: PHP/5.6.4 Access-Control-Allow-Origin: * Content-Length: 363 Content-Type: application/json; charset=utf8 {"events":"https:\/\/api.joind.in\/v2.1\/events","hot-events":"https:\/\/api.joind.in\/v2.1\/events?filter=hot","upcoming-events":"https:\/\/api.joind.in\/v2.1\/events?filter=upcoming","past-events":"https:\/\/api.joind.in\/v2.1\/events?filter=past","open-cfps":"https:\/\/api.joind.in\/v2.1\/events?filter=cfp","docs":"http:\/\/joindin.github.io\/joindin-api\/"} |
What I would like to do is pretty print the body if… continue reading.
Posted on
11 October 2017 in Computing, PHP