Idk about parsing but I can show an example request and response in full.
Hereās a request on WFHBās actual data looking at one hour on Apr 1 2022 (Friday next week).
$ curl -s -G -i -H 'Authorization: Bearer SECRET' https://spinitron.com/api/shows \
-d start=2022-04-01T12:00:00Z -d end=2022-04-01T13:00:00Z
HTTP/2 200
server: nginx
date: Thu, 24 Mar 2022 16:12:51 GMT
content-type: application/json; charset=UTF-8
x-pagination-total-count: 3
x-pagination-page-count: 1
x-pagination-current-page: 1
x-pagination-per-page: 20
link: <https://spinitron.com/api/shows?start=2022-04-01T12%3A00%3A00Z&end=2022-04-01T13%3A00%3A00Z&page=1>; rel=self
set-cookie: _csrf=3a3ba6c7e2473f5fa84140a7e179138908aa8de033410bd0bc7ea6387d18ebbea%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22g3S_CkunW_4XQ77wjSbgMxjTXzcqXFhu%22%3B%7D; path=/; HttpOnly
x-ua-compatible: IE=Edge
x-content-type-options: nosniff
cache-control: no-transform
{"items":[{"id":164985,"start":"2022-04-01T10:00:00+0000","end":"2022-04-01T12:00:00+0000","duration":7200,"timezone":"America/New_York","one_off":false,"category":"Music","title":"Fri Morning Mix 1","description":"","since":null,"url":"","hide_dj":0,"image":"https://farm2.staticflickr.com/1479/23705954504_ceef3fd1e2_m.jpg","_links":{"self":{"href":"https://spinitron.com/api/shows/164985"},"personas":[{"href":"https://spinitron.com/api/personas/126666"},{"href":"https://spinitron.com/api/personas/155984"}],"playlists":{"href":"/api/playlists?show_id=164985"}}},{"id":164868,"start":"2022-04-01T12:00:00+0000","end":"2022-04-01T13:00:00+0000","duration":3600,"timezone":"America/New_York","one_off":false,"category":"News","title":"Democracy Now!","description":"<p>National and international news. Democracy Now! is a national, daily, independent, award-winning news program hosted by journalists Amy Goodman and Juan Gonzalez.</p>","since":null,"url":"http://democracynow.org","hide_dj":1,"image":"https://spinitron.com/images/Show/16/48/164868-img_show-original.png?v=1556555020","_links":{"self":{"href":"https://spinitron.com/api/shows/164868"},"personas":[{"href":"https://spinitron.com/api/personas/126588"}],"playlists":{"href":"/api/playlists?show_id=164868"}}},{"id":164997,"start":"2022-04-01T13:00:00+0000","end":"2022-04-01T15:00:00+0000","duration":7200,"timezone":"America/New_York","one_off":false,"category":"Music","title":"Fri Morning Mix 2","description":"","since":null,"url":"","hide_dj":0,"image":"https://farm5.staticflickr.com/4101/4931771381_4bc4875d58_m.jpg","_links":{"self":{"href":"https://spinitron.com/api/shows/164997"},"personas":[{"href":"https://spinitron.com/api/personas/126855"},{"href":"https://spinitron.com/api/personas/161390"}],"playlists":{"href":"/api/playlists?show_id=164997"}}}],"_links":{"self":{"href":"https://spinitron.com/api/shows?start=2022-04-01T12%3A00%3A00Z&end=2022-04-01T13%3A00%3A00Z&page=1"}},"_meta":{"totalCount":3,"pageCount":1,"currentPage":1,"perPage":20}}
The cURL opts mean
-
-s
donāt display the progress thermometer.
-
-G
use a GET request and encode -d params into the URL as query params
-
-i
display HTTP response headers
-
-H
sets a request header
-
-d
sets data to be used in a query parameter
Hereās the same thing but without the -i
and formatting the JSON response for readability using jq
.
$ curl -s -G -H 'Authorization: Bearer SECRET' https://spinitron.com/api/shows \
-d start=2022-04-01T12:00:00Z -d end=2022-04-01T13:00:00Z | jq .
{
"items": [
{
"id": 164985,
"start": "2022-04-01T10:00:00+0000",
"end": "2022-04-01T12:00:00+0000",
"duration": 7200,
"timezone": "America/New_York",
"one_off": false,
"category": "Music",
"title": "Fri Morning Mix 1",
"description": "",
"since": null,
"url": "",
"hide_dj": 0,
"image": "https://farm2.staticflickr.com/1479/23705954504_ceef3fd1e2_m.jpg",
"_links": {
"self": {
"href": "https://spinitron.com/api/shows/164985"
},
"personas": [
{
"href": "https://spinitron.com/api/personas/126666"
},
{
"href": "https://spinitron.com/api/personas/155984"
}
],
"playlists": {
"href": "/api/playlists?show_id=164985"
}
}
},
{
"id": 164868,
"start": "2022-04-01T12:00:00+0000",
"end": "2022-04-01T13:00:00+0000",
"duration": 3600,
"timezone": "America/New_York",
"one_off": false,
"category": "News",
{
"href": "https://spinitron.com/api/personas/126588" }
],
"playlists": {
"href": "/api/playlists?show_id=164868"
}
}
},
{
"id": 164997,
"start": "2022-04-01T13:00:00+0000",
"end": "2022-04-01T15:00:00+0000",
"duration": 7200,
"timezone": "America/New_York",
"one_off": false,
"category": "Music",
"title": "Fri Morning Mix 2",
"description": "",
"since": null,
"url": "",
"hide_dj": 0,
"image": "https://farm5.staticflickr.com/4101/4931771381_4bc4875d58_m.jpg",
"_links": {
"self": {
"href": "https://spinitron.com/api/shows/164997"
},
"personas": [
{
"href": "https://spinitron.com/api/personas/126855"
},
{
"href": "https://spinitron.com/api/personas/161390"
}
],
"playlists": {
"href": "/api/playlists?show_id=164997"
}
}
}
],
"_links": {
"self": {
"href": "https://spinitron.com/api/shows?start=2022-04-01T12%3A00%3A00Z&end=2022-04-01T13%3A00%3A00Z&page=1"
}
},
"_meta": {
"totalCount": 3,
"pageCount": 1,
"currentPage": 1,
"perPage": 20
}
}
There are also some simple examples in the api docs.
Does this help?