API Documentation
Servers
Production server: memoryreel.com
Staging server: staging.memoryreel.com Testing and development should be done on this server.
For ALL API requests
- device_id
iPhone example
NSString *device_id = [[UIDevice currentDevice] uniqueIdentifier];Android example
import android.provider.Settings.Secure; private String android_id = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID); - application_id
iPhone example
NSString *application_id = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];Android example
String application_id = getApplicationContext().getPackageName(); - client_id
The ID of the client this application is for. Contact us to get this information
Common behavior when creating and updating records
The following only applies to requests made for a JSON formatted response. To receive a JSON response to queries either append ".json" to the end of the url or add a "format" parameter to the request with a value of "json". Both methods are used in the following documentation.
If the object obtained from parsing the JSON has an "errors" attribute then something went wrong saving the record. The errors attribute is a hash keyed with the record's column names and having values that are arrays of strings explaining the problem saving the value for that column. Let's say you're signing up and you try to use a name that's already in use. The response will be something like this
Example response with errors when trying to sign up
{
"name"=>"Elise Wood",
"created_at"=>"Fri Feb 11 09:13:11 UTC 2011",
"id"=>null,
"time_zone"=>"Central Time (US & Canada)",
"locale"=>"en",
"email"=>"glytch@glytch.org",
"errors" => {
"password"=>["can't be blank"],
"name"=>["has already been taken"]
}
}
When a record is save successfully it'll be returned with an id attribute and without the errors attribute.
Authentication via HTTP basic
Post to the following URL first to verify the login credentials. If that's successful use that login information for HTTP basic auth during any requests that require authentication.
- Method: POST
- URL: /users/mobile_login.json
- Parameters
- password
- Response
If the resulting json object has an "errors" attribute that isn't empty then something went wrong. Check the errors attribute to find out what.
If authentication was successful you'll get back a json representation of the user.
Sign Up
- Method: POST
- URL: /users.json
- Parameters
- password
- name
- Response
If the resulting json object has an "errors" attribute that isn't empty then something went wrong. Check the errors attribute to find out what.
If sign up was successful you'll get back a json representation of the user.
Update user's avatar
Requires authentication
- Method: PUT
- URL: /users/USER-ID.json
- Parameters
- avatar
New avatar image
- _method
If you can't make a PUT request make a POST request and include the _method parameter with a value of PUT.
- avatar
Display a user's avatar
To display a user's avatar use the following URL convention.
http://staging.memoryreel.com/system/avatars/USER-ID/USER-ID_SIZE.png
http://staging.memoryreel.com/system/avatars/10/10_large.png
Available sizes
| Size | Size(pixels) | URL | Image |
|---|---|---|---|
| mini | 24x24 | http://staging.memoryreel.com/system/avatars/10/10_mini.png | |
| small | 32x32 | http://staging.memoryreel.com/system/avatars/10/10_small.png | |
| normal | 48x48 | http://staging.memoryreel.com/system/avatars/10/10_normal.png | |
| large | 64x64 | http://staging.memoryreel.com/system/avatars/10/10_large.png | |
| original | ? | http://staging.memoryreel.com/system/avatars/10/10_original.jpg |
Get the event list
- Method: GET
- URL: /events.json
- Parameters
- per_page
How many events to return on each page. Two per page. Twenty-five per page
- page
Show results for this page of results. Page one, two, three.
- order
Controls the sort order. the value can be nothing, name, proximity or starts_at. starts_at being the time that the event started. If you use the proximity option you must also provide a latitude and longitude parameter
- latitude
Optional parameter. Only required when sorting by proximity.
- longitude
Optional parameter. Only required when sorting by proximity.
- search
Only show events who's name or description matches this search term
- user_id
Only show events that were created by the user with this id.
- per_page
Example event JSON
{
"name":"Earth Day Dallas 2011",
"slug":"earth-day-dallas-2011",
"address":"N Pearl St, Dallas, TX, USA",
"city":"Dallas",
"latitude":"32.790578",
"country":"US",
"image_url":"/system/event_images/43/43_thumb.png?1303434749",
"stops_on_s":"April 25, 2011",
"postal_code":"",
"starts_on_s":"April 21, 2011",
"user_ids":[4],
"id":"43",
"street_address":"N Pearl St",
"ends_on_s":"April 25, 2011",
"event_plans":[
{
"name":"Lunch and business talks",
"created_at":"2011-05-02T17:15:59Z",
"event_id":43,
"updated_at":"2011-05-02T17:15:59Z",
"stops_at":"2011-05-02T22:00:00Z",
"starts_at":"2011-05-02T20:00:00Z",
"id":2,
"description":"stuff"
}
],
"longitude":"-96.8004123",
"description":"Be Engaged. Be Entertained.\r\nBe Inspired. Be Green.\r\n\r\nFood, Fun, Facts and More. At Earth Day Dallas, There's Something For Everyone.",
"state":"TX"
}
Get the logged in user's favorite events
Requires authentication
- Method: GET
- URL: /events/favorites.json
- Parameters
- per_page
How many events to return on each page.
- page
Show results for this page.
- per_page
Add an event to favorites
Requires authentication
- Method: PUT
- URL: /events/EVENT-ID/join.json
- Parameters
- _method
If you can't make a PUT request do a POST request and include this optional parameter with a value of "PUT".
- _method
Get an event's content
- Method: GET
- URL: /events/EVENT-ID/items.json
- Parameters
- per_page
How many items to return on each page.
- page
Show results for this page of results.
- type
The types of media to return. This will be changing often as we add more services.
FlickrPhoto, TwitterStatus, MemoryPhoto, MemoryStatus, YFrogPhoto, TwitPic, YFrogVideo, FacebookStatus, FacebookPhoto, FacebookVideo, FacebookLink
To see multiple types separate them by commas. For example
FacebookLink,YFrogPhoto,TwitPic - pulse
Return the most popular items for this event.
- per_page
Posting a status update, photo, or check-in
Requires authentication
- Method: POST
- URL: /events/EVENT-ID/items.json
- Parameters
- body
The status update or photo caption.
- device_id
Unique identifier for the device posting this.
- application_id
Unique identifier for the application posting this. For example com.memoryreel.mobile.
- latitude
Optional latitude where this is being posted from. Definitely include this for check-ins.
- longitude
Optional longitude where this is being posted from. Always include for check-ins if available.
- image
The image to post. The image can also be posted as the raw HTTP POST body if necessary.
- type
Set the value to MemoryStatus to post a status update, MemoryPhoto to post a photo, and CheckIn to check in to an event.
- body
Scan a QR code
Requires authentication
- Method: GET
- URL: The URL is encoded into the QR code.
- Result
You'll get back a json object with a message and a url attribute. If the URL is there, open it in a webview. And if the message attribute isn't blank, display it.
List the logged in user's active event plans
Requires authentication
Active meaning it ends sometime today or later
- Method: GET
- URL: /schedule.json
- Parameters
- event_id
Only return event_plans for the event with this id from the logged in user's schedule
- event_id
Add an event plan to the logged in user's schedule
Requires authentication
- Method: POST
- URL: /event_plans/EVENT-PLAN-ID/event_plan_users.json
Remove an event plan from the logged in user's schedule
Requires authentication
- Method: DELETE
- URL: /event_plans/EVENT-PLAN-ID/event_plan_users/EVENT-PLAN-ID
- Parameters
- format
Value should be JSON if you want a json result. Other options are HTML, which redirects, and XML.
- _method
If you can't make a DELETE request do a POST request and include this optional parameter with a value of "DELETE".
- format
Add a device for receiving push notifications
Requires authentication
- Method: POST
- URL: /devices.json
- Parameters:
- device_id
iPhone example
NSString *device_id = [[UIDevice currentDevice] uniqueIdentifier];Android example
import android.provider.Settings.Secure; private String android_id = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID); - application_id
iPhone example
NSString *application_id = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];Android example
String application_id = getApplicationContext().getPackageName(); - token - iPhone only
The device token generated on the phone by APNS.
Example "c9d4c07c fbbc26d6 ef87a44d 53e16983 1096a5d5 fd825475 56659ddd f715defc" -
model
Optional device model. Example: "iPhone 3GS (4.3.1)"
- device_id
Delete a device and stop it from receiving push notifications
Requires authentication
Only one of either id, device_id or device_token are required
- Method: DELETE
- URL: /devices/DEVICE-ID.json
- Parameters:
- id
The database ID of this device. You receive this as the "id" attribute of the JSON object returned when creating a device and when getting the list of devices. This can also be the device_id, such as "024ead64dbcec07ca468920cacde10cf6237ba86", or the device_token such as "c9d4c07c fbbc26d6 ef87a44d 53e16983 1096a5d5 fd825475 56659ddd f715defc".
- _method
If you can't make a DELETE request do a POST request and include this optional parameter with a value of "DELETE".
- id
List devices available for push notifications
Requires authentication
- Method: GET
- URL: /devices.json
Registered Devices
[
{
"model":"iPhone 3GS (4.3.1)",
"created_at":"2011-05-04T16:36:14-05:00",
"updated_at":"2011-05-04T16:36:14-05:00",
"application_id":"com.memoryreel.mobile",
"id":1,
"user_id":2,
"device_id":"024ead64dbcec07ca468920cacde10cf6237ba86"
}
]
Get the logged in user's unread notifications
Requires authentication
- Method: GET
- URL: /notifications.json
Mark a notification as read
Requires authentication
- Method: DELETE
- URL: /notifications/NOTIFICATION-ID.json
- Parameters:
- id
The database ID of this notification.
- _method
If you can't make a DELETE request do a POST request and include this optional parameter with a value of "DELETE".
- id
Create a notification for the logged in user
Requires authentication
- Method: POST
- URL: /notifications.json
- Parameters:
- alert
The message for the notification
- badge
Number badge for the application icon(iphone)
- sound
a value of true or 1 says this notification should play a sound on the device
- alert