Skip to content

Instantly share code, notes, and snippets.

@yellow5
Created June 8, 2016 14:33
Show Gist options
  • Save yellow5/a5cdc0733c52b370caa57fdbd034a0da to your computer and use it in GitHub Desktop.
Save yellow5/a5cdc0733c52b370caa57fdbd034a0da to your computer and use it in GitHub Desktop.
This gist showcases various stages of the devotional API endpoint in JSON-API format.
vagrant@vagrant-jessie64:~/projects/upperroom/content_creation_service(wip/spike-trailblazer)$ git checkout 890cc936f3f7ad709947b71098f6191b1ced4a8f
.......
vagrant@vagrant-jessie64:~/projects/upperroom/content_creation_service((detached from 890cc93))$ http localhost:3000/api/v1/devotionals/12
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: Keep-Alive
Content-Length: 624
Content-Type: application/json; charset=utf-8
Date: Wed, 08 Jun 2016 14:26:19 GMT
Etag: W/"e1bd33b95c3b6ff9dcf292916a8c1914"
Server: WEBrick/1.3.1 (Ruby/2.3.1/2016-04-26)
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 417744b9-ef5d-49bc-99de-b61082d32a5e
X-Runtime: 0.167703
X-Xss-Protection: 1; mode=block
{
"devotionals": {
"author": {
"location": "here",
"name": "me"
},
"body_text": "body text",
"id": 12,
"long_reading": {
"bible_verses": [
{
"bible_book": {
"name": "Genesis",
"number": 1,
"translation": "ESV"
},
"chapter": 1,
"text": "verse",
"verse": 2
}
],
"full_source": "very long source",
"full_text": "very long text"
},
"meditation_date": "2016-06-07",
"prayer": "please",
"prayer_focus": "focus on",
"quoted_scripture": {
"bible_verses": [
{
"bible_book": {
"name": "Genesis",
"number": 2,
"translation": "NASB"
},
"chapter": 2,
"text": "another verse",
"verse": 3
}
],
"full_source": "quoted source",
"full_text": "quoted text"
},
"thought_of_the_day": "thinkings",
"title": "my dev title"
}
}
vagrant@vagrant-jessie64:~/projects/upperroom/content_creation_service(wip/spike-trailblazer)$ git checkout 3845928353a8fb7eaffcf44a02693d3b744f1b31
.......
vagrant@vagrant-jessie64:~/projects/upperroom/content_creation_service((detached from 3845928))$ http localhost:3000/api/v1/devotionals/12
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: Keep-Alive
Content-Length: 718
Content-Type: application/vnd.api+json
Date: Wed, 08 Jun 2016 14:28:58 GMT
Etag: W/"01ba8a08f1d6671d6824971bfa4cd563"
Server: WEBrick/1.3.1 (Ruby/2.3.1/2016-04-26)
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 93d16a10-b042-470f-810b-3f07c6b4e972
X-Runtime: 0.109178
X-Xss-Protection: 1; mode=block
{
"data": {
"attributes": {
"author": {
"location": "here",
"name": "me"
},
"body_text": "body text",
"long_reading": {
"bible_verses": [
{
"bible_book": {
"name": "Genesis",
"number": 1,
"translation": "ESV"
},
"chapter": 1,
"text": "verse",
"verse": 2
}
],
"full_source": "very long source",
"full_text": "very long text"
},
"meditation_date": "2016-06-07",
"prayer": "please",
"prayer_focus": "focus on",
"quoted_scripture": {
"bible_verses": [
{
"bible_book": {
"name": "Genesis",
"number": 2,
"translation": "NASB"
},
"chapter": 2,
"text": "another verse",
"verse": 3
}
],
"full_source": "quoted source",
"full_text": "quoted text"
},
"thought_of_the_day": "thinkings",
"title": "my dev title"
},
"id": "12",
"links": {
"self": "http://localhost:3000/api/v1/devotionals/12"
},
"type": "devotionals"
}
}
vagrant@vagrant-jessie64:~/projects/upperroom/content_creation_service(wip/spike-trailblazer)$ http localhost:3000/api/v1/devotionals/12
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: Keep-Alive
Content-Length: 935
Content-Type: application/vnd.api+json
Date: Wed, 08 Jun 2016 14:30:47 GMT
Etag: W/"37265ad8d23be7f3dccf93fad22be4eb"
Server: WEBrick/1.3.1 (Ruby/2.3.1/2016-04-26)
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: 0ce92c85-0b7f-4b98-92aa-782b26ab4379
X-Runtime: 0.051376
X-Xss-Protection: 1; mode=block
{
"data": {
"attributes": {
"body_text": "body text",
"meditation_date": "2016-06-07",
"prayer": "please",
"prayer_focus": "focus on",
"thought_of_the_day": "thinkings",
"title": "my dev title"
},
"id": "12",
"links": {
"self": "http://localhost:3000/api/v1/devotionals/12"
},
"relationships": {
"author": {
"data": {
"id": "9",
"type": "authors"
},
"links": {
"related": "http://localhost:3000/api/v1/devotionals/12/author",
"self": "http://localhost:3000/api/v1/devotionals/12/relationships/author"
}
},
"long_reading": {
"data": {
"id": "3",
"type": "long_readings"
},
"links": {
"related": "http://localhost:3000/api/v1/devotionals/12/long-reading",
"self": "http://localhost:3000/api/v1/devotionals/12/relationships/long-reading"
}
},
"quoted_scripture": {
"data": {
"id": "3",
"type": "quoted_scriptures"
},
"links": {
"related": "http://localhost:3000/api/v1/devotionals/12/quoted-scripture",
"self": "http://localhost:3000/api/v1/devotionals/12/relationships/quoted-scripture"
}
}
},
"type": "devotionals"
}
}
vagrant@vagrant-jessie64:~/projects/upperroom/content_creation_service(wip/spike-trailblazer)$ http localhost:3000/api/v1/devotionals/12 include==author,long_reading,long_reading.bible_verses,quoted_scripture,quoted_scripture.bible_verses
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: Keep-Alive
Content-Length: 2673
Content-Type: application/vnd.api+json
Date: Wed, 08 Jun 2016 14:31:58 GMT
Etag: W/"374b7864ec50fe641754fb8ecafee8d1"
Server: WEBrick/1.3.1 (Ruby/2.3.1/2016-04-26)
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Request-Id: c4cecbe6-c8c2-45da-9892-51f8c54a554f
X-Runtime: 0.059552
X-Xss-Protection: 1; mode=block
{
"data": {
"attributes": {
"body_text": "body text",
"meditation_date": "2016-06-07",
"prayer": "please",
"prayer_focus": "focus on",
"thought_of_the_day": "thinkings",
"title": "my dev title"
},
"id": "12",
"links": {
"self": "http://localhost:3000/api/v1/devotionals/12"
},
"relationships": {
"author": {
"data": {
"id": "9",
"type": "authors"
},
"links": {
"related": "http://localhost:3000/api/v1/devotionals/12/author",
"self": "http://localhost:3000/api/v1/devotionals/12/relationships/author"
}
},
"long_reading": {
"data": {
"id": "3",
"type": "long_readings"
},
"links": {
"related": "http://localhost:3000/api/v1/devotionals/12/long-reading",
"self": "http://localhost:3000/api/v1/devotionals/12/relationships/long-reading"
}
},
"quoted_scripture": {
"data": {
"id": "3",
"type": "quoted_scriptures"
},
"links": {
"related": "http://localhost:3000/api/v1/devotionals/12/quoted-scripture",
"self": "http://localhost:3000/api/v1/devotionals/12/relationships/quoted-scripture"
}
}
},
"type": "devotionals"
},
"included": [
{
"attributes": {
"location": "here",
"name": "me"
},
"id": "9",
"links": {
"self": "http://localhost:3000/api/v1/authors/9"
},
"type": "authors"
},
{
"attributes": {
"chapter": 1,
"text": "verse",
"verse": 2
},
"id": "2",
"links": {
"self": "http://localhost:3000/api/v1/bible-verses/2"
},
"relationships": {
"bible_book": {
"data": {
"id": "2",
"type": "bible_books"
},
"links": {
"related": "http://localhost:3000/api/v1/bible-verses/2/bible-book",
"self": "http://localhost:3000/api/v1/bible-verses/2/relationships/bible-book"
}
}
},
"type": "bible_verses"
},
{
"attributes": {
"chapter": 2,
"text": "another verse",
"verse": 3
},
"id": "3",
"links": {
"self": "http://localhost:3000/api/v1/bible-verses/3"
},
"relationships": {
"bible_book": {
"data": {
"id": "3",
"type": "bible_books"
},
"links": {
"related": "http://localhost:3000/api/v1/bible-verses/3/bible-book",
"self": "http://localhost:3000/api/v1/bible-verses/3/relationships/bible-book"
}
}
},
"type": "bible_verses"
},
{
"attributes": {
"full_source": "very long source",
"full_text": "very long text"
},
"id": "3",
"links": {
"self": "http://localhost:3000/api/v1/long-readings/3"
},
"relationships": {
"bible_verses": {
"data": [
{
"id": "2",
"type": "bible_verses"
}
],
"links": {
"related": "http://localhost:3000/api/v1/long-readings/3/bible-verses",
"self": "http://localhost:3000/api/v1/long-readings/3/relationships/bible-verses"
}
}
},
"type": "long_readings"
},
{
"attributes": {
"full_source": "quoted source",
"full_text": "quoted text"
},
"id": "3",
"links": {
"self": "http://localhost:3000/api/v1/quoted-scriptures/3"
},
"relationships": {
"bible_verses": {
"data": [
{
"id": "3",
"type": "bible_verses"
}
],
"links": {
"related": "http://localhost:3000/api/v1/quoted-scriptures/3/bible-verses",
"self": "http://localhost:3000/api/v1/quoted-scriptures/3/relationships/bible-verses"
}
}
},
"type": "quoted_scriptures"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment