Fortune Cookie API Documentation Back to top

Fortune Cookie API

Fortune Cookie API retrieves data to create a fortune cookie - fortunes, lotto numbers, and a brief lesson in Simplified Chinese.

Authentication

None currently.

Media Types

JSON responses.

Error States

The common HTTP Response Status Codes are used.

Fortunes

Fortunes are a key component to a fortune cookie. Fortunes contain a message, often a proverb the reader can easily relate to his or her own experiences, giving the illusion of a mysterious connection between self and cookie.

Fortunes Collection

List all Fortunes
GET/v1/fortunes{?limit,skip,page}

Example URI

GET http://fortunecookieapi.herokuapp.com/v1/fortunes?limit=&skip=&page=
URI Parameters
HideShow
limit
integer (optional) 

Quantity of fortunes to return, default 100, max 1000

skip
integer (optional) 

Fortunes to skip before fetching, default 0

page
integer (optional) 

Page number taking into account given limit, default 1

Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "id": "53ffcf1d4ea4f76d1b8f223e",
    "message": "This fortune intentionally left blank"
  },
  {
    "id": "53ffcf1d4ea4f76d1b8f223f",
    "message": "Tomorrow is a latter-day"
  }
]

Fortune

A single Fortune object with all its details

Retrieve a Fortune
GET/v1/fortunes/{id}

Example URI

GET http://fortunecookieapi.herokuapp.com/v1/fortunes/1
URI Parameters
HideShow
id
number (required) Example: 1

id of the Fortune to perform action with. Has example value.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": "53ffcf1d4ea4f76d1b8f223f",
  "message": "This fortune intentionally left blank"
}

Lessons

A lesson in simplified Chinese. Gives the user a common word or phrase in English, the Chinese alphabet, and a pronunciation. After a gluttonous meal, there’s no better thank you than butchering the language of the restaurant staff while crunching down two or three cookies.

Lessons Collection

List all Lessons
GET/v1/lessons{?limit,skip,page}

Example URI

GET http://fortunecookieapi.herokuapp.com/v1/lessons?limit=&skip=&page=
URI Parameters
HideShow
limit
integer (optional) 

Quantity of lessons to return, default 100, max 1000

skip
integer (optional) 

Fortunes to skip before fetching, default 0

page
integer (optional) 

Page number taking into account given limit, default 1

Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "id": "53ffcf1d4ea4f76d1b8f223e",
    "chinese": "因特网",
    "romanization": "yintewang",
    "english": "internet"
  },
  {
    "id": "53ffcf1d4ea4f76d1b8f223f",
    "chinese": "狮子狗",
    "romanization": "shizi gou",
    "english": "poodle"
  }
]

Lesson

A single Lesson object with all its details

Retrieve a Lesson
GET/v1/lessons/{id}

Example URI

GET http://fortunecookieapi.herokuapp.com/v1/lessons/1
URI Parameters
HideShow
id
number (required) Example: 1

id of the Lesson to perform action with. Has example value.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": "53ffcf1d4ea4f76d1b8f223f",
  "chinese": "因特网",
  "romanization": "yintewang",
  "english": "internet"
}

Lottos

Lotto numbers are 6 numbers ranging from 0 to 59, coninciding with US Powerball numbers. No one has ever won the Powerball using the numbers from a fortune cookie, but fortune-makers still need something to fill in the extra white-space.

Lottos Collection

List all Lottos
GET/v1/lottos{?limit,skip,page,firstId}

Example URI

GET http://fortunecookieapi.herokuapp.com/v1/lottos?limit=&skip=&page=&firstId=
URI Parameters
HideShow
limit
integer (optional) 

Quantity of lotto numbers to return, default 100, max 1000

skip
integer (optional) 

Fortunes to skip before fetching, default 0

page
integer (optional) 

Page number taking into account given limit, default 1

firstId
string (optional) 

Initial lotto to fetch, default “000000000000000000000000”

Response  200
HideShow
Headers
Content-Type: application/json
Body
[
  {
    "id": "001000200030004000500006",
    "numbers": [
      10,
      20,
      30,
      40,
      50,
      6
    ]
  },
  {
    "id": "001500240011000900100055",
    "numbers": [
      15,
      24,
      11,
      9,
      10,
      55
    ]
  }
]

Lotto

A single Lotto object with all its details

Retrieve a Lotto
GET/v1/lottos/{id}

Example URI

GET http://fortunecookieapi.herokuapp.com/v1/lottos/001000200030004000500006
URI Parameters
HideShow
id
number (required) Example: 001000200030004000500006

id of the Lotto to perform action with.

Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": "001000200030004000500006",
  "numbers": [
    10,
    20,
    30,
    40,
    50,
    6
  ]
}

Generated by aglio on 13 Jan 2017