Skip to content
Slav Kurilyak edited this page Mar 26, 2015 · 4 revisions

This is the official API documentation for Humon.

Staging endpoints are located at humon-staging.herokuapp.com. Production endpoints are located at api.humon.io. API version is scoped via the URL. For example:

    https://api.humon.io/v1/events/:id

All POST and PATCH endpoints accept JSON data in the body of the request. All requests require a 'Content-Type': 'application/json' header. All responses are JSON.

POST /events

Example request data:

{
  'address' : '85 2nd Street',
  'ended_at' : '2013-09-17T00:00:00.000Z',
  'lat' : 37.8050217,
  'lon' : -122.409155,
  'name' : 'Best event OF ALL TIME!',
  'started_at' : '2013-09-16T00:00:00.000Z',
}
  • Required: lat, lon, name, started_at
  • Required headers: 'tb-device-token': EVENT_OWNER_DEVICE_TOKEN
  • Optional: address, ended_at

Example response:

{
  'id' : '123'
}

Example 422 response:

{
  'message' :  'Validation Failed',
  'errors' : [
    "Lat can't be blank",
    "Name can't be blank"
  ]
}

GET /events/EVENT_ID

Example response:

{
  'address' : '85 2nd Street',
  'ended_at' : '2013-09-17T00:00:00.000Z',
  'lat' : 37.8050217,
  'lon' : -122.409155,
  'name' : 'Best event OF ALL TIME!',
  'started_at' : '2013-09-16T00:00:00.000Z',
  'owner' : {
    'id' : '123'
  }
}

PATCH /events/EVENT_ID

Example request data:

{
  'address' : '85 2nd Street',
  'ended_at' : '2013-09-17T00:00:00.000Z',
  'lat' : 37.8050217,
  'lon' : -122.409155,
  'name' : 'Best event EVERRR!',
  'started_at' : '2013-09-16T00:00:00.000Z',
  'owner' : {
    'id' : '123'
  }
}
  • Required: lat, lon, name, started_at owner[id]
  • Required headers: 'tb-device-token': EVNET_OWNER_DEVICE_TOKEN
  • Optional: address, ended_at

Example response:

{
  'id' : '123'
}

Example 422 response:

{
  'message' :  'Validation Failed',
  'errors' : [
    "Lon can't be blank",
  ]
}

POST /users

Example request data:

{}
  • Required headers: 'tb-device-token': DEVICE_TOKEN, 'tb-app-secret': APP_SECRET

Example response:

{
  'device_token' : '123abc456xyz',
  'id': '123',
}

GET /events/nearests?lat=LAT&lon=LON&radius=RADIUS

Radius units are kilometers. Example response data:

 [
   {
    'address' : '85 2nd Street',
    'ended_at' : '2013-09-17T00:00:00.000Z',
    'lat' : 37.8050217,
    'lon' : -122.409155,
    'name' : 'Best event EVERRR!',
    'started_at' : '2013-09-16T00:00:00.000Z',
    'owner' : {
      'id' : '1233'
    },
    {
      'address' : '88 2nd Street',
      'ended_at' : '2013-09-17T00:00:00.000Z',
      'lat' : 37.8050217,
      'lon' : -122.409155,
      'name' : 'some other event',
      'started_at' : '2013-09-16T00:00:00.000Z',
      'owner' : {
        'id' : '123'
      }
    }
  ]

POST /attendances

Example request data:

{
  'event' : {
    'id' : '5'
  }
}
  • Required headers: 'tb-device-token': '123abc456xyz'