- All API calls are made to api.notifsta.com/v1. Prefix this to all URLs below.
- All API calls return a "status" and a "data". If successful, "status" will always be "success"; if not, always "failure". "data" contains the response.
-
Expects email and password.
-
Responds with User, including Events, and Channels.
-
Request:
api.notifsta.com/v1/auth/login/[email protected]&password=asdf
-
Response:
{ "status": "success", "data": { "id": 1, "email": "[email protected]", "admin": true, "locked": false, "created_at": "2015-03-21T07:12:54.705Z", "updated_at": "2015-03-21T07:12:54.705Z", "phone": null, "authentication_token": "Q6VzX_oGdybdoZGjiLqv", "events": [ { "id": 1, "name": "hack_london", "created_at": "2015-03-21T07:12:59.771Z", "updated_at": "2015-03-21T07:12:59.771Z", "channels": [ { "event_id": 1, "id": 1, "name": "General", "created_at": "2015-03-21T07:12:59.804Z", "updated_at": "2015-03-21T07:12:59.804Z" }, { "event_id": 1, "id": 2, "name": "Food", "created_at": "2015-03-21T07:12:59.809Z", "updated_at": "2015-03-21T07:12:59.809Z" }, { "event_id": 1, "id": 3, "name": "Logistics", "created_at": "2015-03-21T07:12:59.818Z", "updated_at": "2015-03-21T07:12:59.818Z" } ] } ] } }
- Expects authentication_token, and logs out.
- Please don't use, since this logs out on all sessions.
- Once logged in via cookie in Rails, this returns an authentication token.
- Returns a User, along with her Events and Channels.
- Reqest:
api.notifsta.com/v1/users/[email protected]&user_token=Q6VzX_oGdybdoZGjiLqv
- The same response as above.
-
Returns a Event, along with its Channels.
-
Request:
api.notifsta.com/v1/events/[email protected]&user_token=Q6VzX_oGdybdoZGjiLqv
-
Response:
{ "status": "success", "data": { "id": 1, "name": "hack_london", "cover_photo_url": "https://hacklondon.org/images/london2.jpg", "start_time": "2015-01-07T18:33:40.224Z", "end_time": "2015-01-08T18:33:40.224Z", "description": null, "address": "Strand Campus, King's College London, WC2R 2LS, London", "longitude": -0.115997, "latitude": 51.5114864, "created_at": "2015-04-07T18:33:40.265Z", "updated_at": "2015-04-07T18:33:40.265Z", "channels": [ { "event_id": 1, "id": 1, "name": "Notifications", "created_at": "2015-04-07T18:33:40.303Z", "updated_at": "2015-04-07T18:33:40.303Z", "notifications": [ { "channel_id": 1, "id": 2, "notification_guts": "What food?", "created_at": "2015-04-07T18:33:40.368Z", "updated_at": "2015-04-07T18:33:40.368Z" }, { "channel_id": 1, "id": 1, "notification_guts": "First notification!", "created_at": "2015-04-07T18:33:40.336Z", "updated_at": "2015-04-07T18:33:40.336Z" } ] } ] } }
-
Index channels for an Event.
-
Request:
api.notifsta.com/v1/events/1/[email protected]&user_token=Q6VzX_oGdybdoZGjiLqv
-
Response:
{ "status": "success", "data": [ { "event_id": 1, "id": 1, "name": "General", "created_at": "2015-03-21T07:12:59.804Z", "updated_at": "2015-03-21T07:12:59.804Z" }, { "event_id": 1, "id": 2, "name": "Food", "created_at": "2015-03-21T07:12:59.809Z", "updated_at": "2015-03-21T07:12:59.809Z" }, { "event_id": 1, "id": 3, "name": "Logistics", "created_at": "2015-03-21T07:12:59.818Z", "updated_at": "2015-03-21T07:12:59.818Z" } ] }
-
Returns a Channel.
-
Request:
api.notifsta.com/v1/channels/1/[email protected]&user_token=Q6VzX_oGdybdoZGjiLqv
-
Response:
{ "status": "success", "data": { "event_id": 1, "id": 1, "name": "General", "created_at": "2015-03-21T07:12:59.804Z", "updated_at": "2015-03-21T07:12:59.804Z" } }
-
Returns a list of Notifications.
-
Request:
api.notifsta.com/v1/channels/1/notifications/[email protected]&user_token=Q6VzX_oGdybdoZGjiLqv
-
Response:
{ "status": "success", "data": [ { "id": 11, "channel_id": 1, "notification_guts": "What food do you want?", "type": "Survey", "created_at": "2015-03-21T07:20:24.009Z", "options": [ { "id": 3, "option_guts": "burgerzzzz", "created_at": "2015-03-21T07:20:24.020Z" }, { "id": 4, "option_guts": "pizza", "created_at": "2015-03-21T07:20:24.027Z" } ], "response": { "id": 6, "option_id": 4, "created_at": "2015-03-21T22:56:27.078Z", "updated_at": "2015-03-21T22:56:27.078Z" } }, { "id": 10, "channel_id": 1, "notification_guts": "Hello J!", "type": "Survey", "created_at": "2015-03-21T07:20:03.913Z", "options": [ { "id": 1, "option_guts": "burgerzzzz", "created_at": "2015-03-21T07:20:03.946Z" }, { "id": 2, "option_guts": "pizza", "created_at": "2015-03-21T07:20:03.954Z" } ], "response": null }, { "id": 3, "channel_id": 1, "notification_guts": "third notification in general!", "type": "Message", "created_at": "2015-03-21T07:12:59.871Z" }, { "id": 2, "channel_id": 1, "notification_guts": "second notification in general!", "type": "Message", "created_at": "2015-03-21T07:12:59.859Z" }, { "id": 1, "channel_id": 1, "notification_guts": "first notification in general!", "type": "Message", "created_at": "2015-03-21T07:12:59.844Z" } ] }
-
Requires a type, which is either "Message" or "Survey". Also requires a "notification_guts", which is the message.
-
If type is "Survey", then an "options" array is expected. This contains all the option_guts, which describe the option (e.g.
options[]=burger&options[]=pizza
). -
Request with Message:
api.notifsta.com/v1/channels/1/notifications/[email protected]&user_token=Q6VzX_oGdybdoZGjiLqv¬ification[notification_guts]=Notifsta!¬ification[type]=Message
-
Response:
{ "status": "success", "data": { "id": 12, "channel_id": 1, "notification_guts": "Notifsta!", "type": "Message", "created_at": "2015-03-21T07:54:17.008Z" } }
-
Request with Survey:
api.notifsta.com/v1/channels/1/notifications/[email protected]&user_token=Q6VzX_oGdybdoZGjiLqv¬ification[notification_guts]=What food?¬ification[type]=Survey&options[]=burger&options[]=pizza
-
Response:
{ "status": "success", "data": { "id": 13, "channel_id": 1, "notification_guts": "What food?", "type": "Survey", "created_at": "2015-03-21T07:55:32.164Z", "options": [ { "id": 5, "option_guts": "burger", "created_at": "2015-03-21T07:55:32.178Z" }, { "id": 6, "option_guts": "pizza", "created_at": "2015-03-21T07:55:32.190Z" } ], "response": null } }
-
Request:
api.notifsta.com/v1/notifications/[email protected]&user_token=Q6VzX_oGdybdoZGjiLqv
-
Response:
{ "status": "success", "data": { "id": 12, "channel_id": 1, "notification_guts": "Notifsta!", "type": "Message", "created_at": "2015-03-21T07:54:17.008Z" } }
-
Admins of the Event can list all responses to a particular Notification.
-
Request:
api.notifsta.com/v1/notifications/11/[email protected]&user_token=Q6VzX_oGdybdoZGjiLqv
-
Response:
{ "status": "success", "data": [ { "id": 1, "option_id": 3, "created_at": "2015-03-21T08:04:04.383Z", "updated_at": "2015-03-21T08:04:04.383Z" } ] }
-
Show an individual response.
-
Can only be done if it's your response, or if you're an Event admin.
-
Request:
api.notifsta.com/v1/notifications/11/responses/[email protected]&user_token=Q6VzX_oGdybdoZGjiLqv
-
Response:
{ "status": "success", "data": { "id": 1, "option_id": 3, "created_at": "2015-03-21T08:04:04.383Z", "updated_at": "2015-03-21T08:04:04.383Z" } }
-
Responses can only be created by POSTing to the same URL as showing a Notification.
-
If the user has a previous response, it is overridden.
-
Request:
api.notifsta.com/v1/notifications/11/[email protected]&user_token=Q6VzX_oGdybdoZGjiLqv&option_id=3
-
Response:
{ "status": "success", "data": { "id": 1, "option_id": 3, "created_at": "2015-03-21T08:04:04.383Z", "updated_at": "2015-03-21T08:04:04.383Z" } }