Overview
Lypp ActiveResource Plugin
Use our new ActiveResource plugin to easily and seamlessly integrate Lypp with your Ruby on Rails project. The plugin's README file provides usage examples for most major API operations.
To install simply run the following command from your project directory:
ruby script/plugin install http://lypp.googlecode.com/svn/trunk/plugins/lypp
If you are not running Rails 2.0, please install ActiveResource with the following command:
gem install activeresource --source http://gems.rubyonrails.org
Note:ActiveResource and our plugin work with Rails 1.2.5 or greater.
Representations
- Requests and responses use the XML 1.0 format and should always be encoded as UTF-8.
-
All requests should include the Accept HTTP header with the XML media type, eg:
Accept: application/xml -
PUT and POST requests must include the Content-Type header with the XML media type, eg:
Content-Type: application/xml -
Responses will always include the Content-Type header with the XML media type, eg:
Content-Type: application/xml -
In the XML datetime values are represented in ISO-8601 format, eg:
2007-09-04T21:03:30Z
Authentication
- A username and password will be required to access the API. Get it here
- Clients should supply the username and password using HTTP Basic Authentication.
- The API can only be accessed using either the Secure Socket Layer 3.0 (SSL v3) or Transport Layer Security (TLS v1) protocols.
-
Please try and set the User-Agent HTTP request header with the name of your client application or library, and its version, eg:
User-Agent: LyppBot/1.0
URLs
/users
/users/{user_id}
/users/{user_id}/contacts
/users/{user_id}/contacts/{contact_id}
/users/{user_id}/conferences
/users/{user_id}/conferences/{conference_id}
/users/{user_id}/conferences/{conference_id}/attendees
/users/{user_id}/conferences/{conference_id}/attendees/{attendee_id}
Methods
The standard HTTP methods GET, POST, PUT and DELETE are used to access resources.
- GET is used for retrieving information about a resource.
- POST is used to add a new resource.
- PUT is used to update an existing resource.
- DELETE is used to remove a resource.
| Method | URL | Description |
|---|---|---|
| POST | /users | Add a new user |
| GET | /users/{user_id} | Show a user |
| PUT | /users/{user_id} | Update a user |
| GET | /users/{user_id}/contacts | List all contacts |
| POST | /users/{user_id}/contacts | Add a new contact |
| GET | /users/{user_id}/contacts/{contact_id} | Show a contact |
| PUT | /users/{user_id}/contacts/{contact_id} | Update a contact |
| DELETE | /users/{user_id}/contacts/{contact_id} | Delete a contact |
| GET | /users/{user_id}/conferences | List all conferences |
| POST | /users/{user_id}/conferences | Add a new conference |
| GET | /users/{user_id}/conferences/{conference_id} | Show a conference |
| PUT | /users/{user_id}/conferences/{conference_id} | Update a conference |
| DELETE | /users/{user_id}/conferences/{conference_id} | Delete a conference |
| GET | /users/{user_id}/conferences/{conference_id}/attendees | List all conference attendees |
| POST | /users/{user_id}/conferences/{conference_id}/attendees | Add a new conference attendee |
| GET | /users/{user_id}/conferences/{conference_id}/attendees/{attendee_id} | Show a conference attendee |
| PUT | /users/{user_id}/conferences/{conference_id}/attendees/{attendee_id} | Update a conference attendee |
| DELETE | /users/{user_id}/conferences/{conference_id}/attendees/{attendee_id} | Delete a conference attendee |
Searching
Appending a query string with the attribute name(s) allows you to search a collection. For example the query string "phone_number=6045555555" would allow you to search for all attendees with a phone number 6045555555:
curl \
-u username:password \
-H 'Accept: application/xml' \
http://lypp.com/users/1/conferences/1/attendees?phone_number=6045555555
Searching can be done using an exact match, or you may append a keyword onto the attribute name to alter the type of search. The following example searches for all attendees with a phone number starting with "604":
curl \
-u username:password \
-H 'Accept: application/xml' \
http://lypp.com/users/1/conferences/1/attendees?phone_number_starts_with=604
Any of the following can be appended to the attribute names to alter the type of search:
| Search Type | Description |
|---|---|
| contains | the attribute must contain the value |
| starts_with | the attribute must start with the value |
| ends_with | the attribute must end with the value |
| gt | the attribute must be greater than the value |
| lt | the attribute must be less than the value |
| gte | the attribute must be greater than or equal to the value |
| lte | the attribute must be less than or equal to the value |
| ne | the attribute must not be equal to the value |
