|
|
REST APIFrom $1Table of contents
This document only covers what is currently implemented in the API. For a roadmap of the API, refer to "Roadmap Draft". Client ImplementationsOverviewAccount Service is the public REST API into the notify.me service. The API serves both end users and notification sources
AuthenticationThe notify.me API provides two mechanisms for providing authentication information:
Both forms of authentication are used to provide the same authentication token to the API. For security reasons, this authentication token is temporary and tied to the client's IP. Any client using the notify.me API must be able to to cope with 401 - Unauthorized response (which includes a Location header for the authentication endpoint) and re-authenticate before continuing. An example authentication workflow follows:
Since the auth token is tied to an IP, clustered client services CANNOT share a single authtoken, but MUST go through the above authetication flow and persist their authentication token locally. Exposing Sources for Users to subscribe toThe href attribute of the affiliate element that is returned in with the following call GET:/accounts/{id}/sources provides a uri that a customer can post for users to subsribe to that source. You can get a notify.me badge for your site from the following page: Notify.me Affiliate Program. Global HeadersNote on Headers: By rfc2616, Http header field names are case-insensitive, i.e. while this document describes headers in mixed-case, it is not guaranteed that the API will return them as such. X-Api-VersionAll API keys should include an X-Api-Version header to indicate the compatibility mode desired. If omitted, the current API compatibility level is assumed X-AuthTo be used for authentication by clients that cannot use cookie authentication. Data TypesLegal Id ValuesA resource id is specified as part of a URI as an alphanumeric ID. {sourceid}, {notificationid} and {subscriptionid} are both resource id's and are created either by:
Notification<notification id="..." href="..."> <uri>...</uri> <subject>...</subject> </notification> id and href are meta-daa about the notification returned by GET requests and are ignored if included in PUT or POST requests. id is the globally unique reference id for the notification associated on creation, while href is the canonical uri to the notification document. Source<source id="..." href="...">
<name>...</name>
<!-- href to be used on source owner site to direct users to www.notify.me
to subscribe -->
<affiliate href="..." />
<!-- uri is optional and used to provide an information link about the source -->
<uri>...</uri>
</source>
id and href are meta-data about the source returned by GET requests and are ignored if included in PUT or POST requests. id is the account unique reference id for the source, either generated by the API on POST or provided as part of the Uri on PUT, while href is the canonical uri to the source document. The default type (i.e. if omitted on create) is api, meaning that the source receives notifications from posts to the REST API. FeaturesAccount InformationRetrieve authentication credential requirementsPath: GET:/accounts/{id}/authenticate This feature returns the challenge key that must be used to execute a successful authenticate PUT Response
Response body <authenticate>
<challenge>...</challenge>
</authenticate>
Authenticate accountPath: POST:/accounts/{id}/authenticate This call must follow a GET on the same URL, since the request body must include the challenge and a response, which consists of an md5sum ofthe account password and the challenge contatenated like {password}{challenge} Request body <authenticate>
<challenge>...</challenge>
<response>...</response>
</authenticate>
Response
Response body The reponse body will always be empty, but on Ok (200) the response will include a authentication cookie (for clients that can use cookies) and an X-Auth header which can be used in lieu of the cookie. SourcesRetrieve all Sources for the accountPath: GET:/accounts/{id}/sources This feature returns all sources owned by the account Request
Response
Response body <sources>
<source>
<!-- see above -->
</source>
...
</sources>
Create a new Source on the accountPath: POST:/accounts/{id}/sources Post a registration of a new source available for subscription by other accounts that this account posts messages to Request Body <source>
<!-- see above -->
</source>
Response
Response Headers
Retrieve Source InformationPath: GET:/accounts/{id}/sources/{sourceid} Create a Source with a specific Id or Modify an existing SourcePath: PUT:/accounts/{id}/sources/{sourceid} Remove an existing SourcePath: DELETE:/accounts/{id}/sources/{sourceid} Post new notification to the sourcePath: POST:/accounts/{id}/sources/{sourceid}/notifications
Tags:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||