Skip to content

jessewaites/iOS_Rails_Backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is the Rails backend for an iPhone (Or iPad, Android… Whatever.) app. The Production endpoint is located at still-castle-7483.herokuapp.com/v1/. (The API version is scoped via the URL.)

For example:

still-castle-7483.herokuapp.com/v1/events/1

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’, ‘owner’ : { ‘device_token’ : ‘123abc456xyz’ } } Required: lat, lon, name, started_at owner 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’ : { ‘device_token’ : ‘123abc456xyz’ } } 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’ : { ‘device_token’ : ‘123abc456xyz’ } } Required: lat, lon, name, started_at owner 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:

{ ‘device_token’ : ‘123abc456xyz’ } Required: device_token Example response:

{ ‘device_token’ : ‘123abc456xyz’, } GET /events/nearest?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’ : { ‘device_token’ : ‘123abc456xyz’ }, { ‘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’ : { ‘device_token’ : ‘123abc456xyz’ } }

POST /attendances

Example request data:

{ ‘event’ : { ‘id’ : ‘5’ }, ‘user’ : { ‘device_token’ : ‘123abc456xyz’ } }

About

Rails backend for iOS app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published