Skip to content

Instantly share code, notes, and snippets.

@joakin
Last active August 29, 2015 14:09
Show Gist options
  • Save joakin/52ec399c976ee3c8fdfc to your computer and use it in GitHub Desktop.
Save joakin/52ec399c976ee3c8fdfc to your computer and use it in GitHub Desktop.
ads api v1

Ads api.

When ommited, the responses will be application/json by default

GET /ads/list

When ok:
  • Status code: 200
[
  {
    "title": "title1",
    "date": 1416346812491
  },
  {
    "title": "title2",
    "date": 1416346812491
  },
  {
    "title": "title3",
    "date": 1416346812491
  }
]
On server error:
  • Status code: 500
  • No response body

PUT /ad

For creating an ad

  • Content-type: application/json
  • Request body:
{
  title: 'Non-empty text max 1000 chars',
  description: 'Maybe empty text max 5000 chars',
  owner: 'Type email field. Mandatory'
}
When ok:
  • Status code: 200
  {
    "title": "title1",
    "description": "description1",
    "date": 1416346028292,
    "owner": "[email protected]"
  }
When validation fails or there is an error:
  • Status code: 500
  • No response body

GET /ad/:id

Getting an ad. The id to pass is the date of the ad

When ok:
  • Status code: 200
  {
    "title": "title1",
    "description": "description1",
    "date": 1416346028292,
    "owner": "[email protected]"
  }
When it doesn't exist or there is an error:
  • Status code: 500
  • No response body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment