Back to notify.me main site

Roadmap Draft

From $1

Draft: This document is only a draft and may change as features are implemented

Overview

Account Service is the public REST API into the notify.me service. The API serves both end users and notification sources

Verb:Suffix Description Available in version
GET:/accounts/{id} Account information  
GET:/accounts/{id}/authenticate Retrieve authentication credential requirements 0.1
POST:/accounts/{id}/authenticate Authenticate the account 0.1
GET:/accounts/{id}/settings Owner modifiable settings  
PUT:/accounts/{id}/settings Modify existing settings  
GET:/accounts/{id}/grants Retrieve all permission grants issued by account  
POST:/accounts/{id}/grants Create a new grant  
PUT:/accounts/{id}/grants/{id} Create or modify a grant  
GET:/accounts/{id}/grants/{id} Retrieve a grant  
DELETE:/accounts/{id}/grants/{id} Revoke a grant  
GET:/accounts/{id}/notifications Retrieve notifications  
POST:/accounts/{id}/notifications Post a new notification to the account  
GET:/accounts/{id}/notifications/{id} Retrieve a notification  
GET:/accounts/{id}/sources Retrieve sources 0.1
POST:/accounts/{id}/sources Create a new source 0.1
GET:/accounts/{id}/sources/{id} Get source information 0.1
PUT:/accounts/{id}/sources/{id} Create or modify a source 0.1
DELETE:/accounts/{id}/sources/{id} Remove a source 0.1
GET:/accounts/{id}/sources/{id}/notifications Get notifications posted to the source  
POST:/accounts/{id}/sources/{id}/notifications Post a new notification to a source 0.1
GET:/accounts/{id}/sources/{id}/notifications/{id} Retrieve a notification  
GET:/accounts/{id}/subscriptions Retrieve all source subscriptions  
POST:/accounts/{id}/subscriptions Create a new subscription without a known source  
PUT:/accounts/{id}/subscriptions/{id} Create or modify a subscription for a source  
DELETE:/accounts/{id}/subscriptions/{id} Remove a source subscription  
GET:/accounts/{id}/subscriptions/{id}/notifications Retrieve notifications posted to the subscription  

Authentication

The notify.me API provides two mechanisms for providing authentication information:

  • An auth cookie (for client frameworks supporting the persistence of cookies)
  • An X-Auth Header (in case cookies are not supported)

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:

  1. Client calls some API uri, such as GET:/accounts/{id}/notifications
  2. Server responds with 401 - Unauthorized, provideing a Location of http://{server}/accounts/{id}/authenicate
  3. Client MUST do a GET on the authentication URI, generally GET:/accounts/{id}/authenicate to retrieve the authentication challenge
  4. Client computes the response to the Server challenge
    1. Client constructs a string from the account password and the challenge node content, like {password}:{challenge}
    2. Client creates a base-64 encoded md5sum hash from the response string
    3. Client constructs an authentication document including the challenge and the computed response
  5. Client POSTs the authentication document at POST:/accounts/{id}/authenicate
  6. Upon verfication of the response string, Server responds with a 200 - Ok, including an auth cookie and an X-Auth header, either one of which can be used for authentication
  7. Client resumes, by calling the original URI providing the new authentication credentials

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 Customers to subscribe to

The GET Uri of a source is also it's identifier for subscription. I.e. if a customer provides this uri as a source in the notify.me webapp or via the IM client and that source is marked public, we will automatically subscribe user to that source.

Global Headers

Note 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, nor does it have any expectations of them being sent in any particular casing.

X-Api-Version

All 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-Auth

To be used for authentication by clients that cannot use cookie authentication

X-Grant

The grant token for authorizing modification of another account's subscription on their behalf.

Data Types

Legal Id Values

A 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:

  • a POST against the base URI for its path (i.e. the Id in the X-Id header)
    • in the POST scenario, it is the responsibility of the API to generate a resource id
  • a PUT against the URI with the resource id as the postfix
    • in the PUT scenario, a resource id is only created if no resource exists at the uri, otherwise an existing resource is updated with the PUT data

Account Data

<account>
    ...
</account>

Account Settings

<account>
    <settings>
        ...
    </settings>
</account>

Grant

<grant id="..." href="...">
    <description>...</description>
    <authtoken>...</authtoken>
    <!-- grantee is optional -->
    <grantee id="...">
</grant>

The Grant authtoken is used as the X-Grant header by a third party account (grantee) to be able to modify subscriptions on the grantor's account, but limited to only to subscriptions to grantee's sources.

Grants can be either global, i.e. any third party can use it, or locked down to a specific grantee. Either way, it limits modifications to subscriptions on the grantor account to sources  on the grantee account.

Notification

<notification id="..." href="...">
  <uri>...</uri>
  <subject>...</subject>
  <body> ...</body>
</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="..." type="(email|api|rss)">
    <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>
  
    <!-- rss href is only used for rss sources and denotes the rss feed uri -->
    <rss href="..." />

    <!-- email is used only for email sources -->
    <email>...</email>
</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. 

Subscription

<subscription id="..." href="...">
    <!-- if the source id isn't known, the source document can be included
         to locate/create the appropriate the source (used by POST) -->
    <source id="...">
        <uri>...</uri>
        ...
    <source>
    
    <destination type="(email|xmpp|pingfm|sms|webhook)"/>
    ...
    <!-- the webhook destination carries along destination and status information -->
    <webhook enabled="(true|false)">
        <uri>...</uri>
        <last-request>
            <date>...</date>
            <status>...</status>
        </last-request>
        <avg-response>...</avg-response>
        <disable-reason>...</disable-reason>
    </destination>
    ...
</subscription >

id and href are meta-data about the subscription returned by GET requests and are ignored if included in PUT or POST requests. id is the account unique reference id for the subscription, either generated by the API on POST or provided as part of the Uri on PUT, while href is the canonical uri to the subscription document.

Features

Account Information

Legal {id} values for Accounts

Values Description
{numeric} Numeric account id
{alphanumeric} Unique account name
current The account associated to the Auth header

Retrieve Account information

Path: GET:/accounts/{id}

This feature provides basic account information. It's path also forms the root for all other account service features.

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response body

<account>
    <!-- see above -->
</account>

Retrieve authentication credential requirements

Path: GET:/accounts/{id}/authenticate

This feature returns the challenge key that must be used to execute a successful authenticate PUT

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request

Request body

<authenticate>
    <challenge>...</challenge>
</account>

Authenticate account

Path: 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>
</account>

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

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.

Retrieve Account Settings

Path: GET:/accounts/{id}/settings

This feature returns mutable settings, such as preferences for an account

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response body

<account>
    <settings>
        <!-- see above -->
    </settings>
</account>

Modify Account Settings

Path: PUT:/accounts/{id}/settings

This feature provides basic account information. It's path also forms the root for all other account service features.

Request body

The request body should be a GET response document with the appropriate changes. The PUT expects the revision on the document and uses it for optimistic locking. I.e. if the current revision number is higher than the one in the request, a response of 409 - Conflict is issued, indicating that the resource has changed since it was last inspected.

Response

Response Response Body Description
Ok (200) text/xml
operation completed successfully, new settings persisted
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access
Conflict (409) text/xml Revision of document does not match the submitted revision

Retrieve Grants

Path: GET:/accounts/{id}/grants

This feature returns all grants issued by this account

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response body

<grants>
    <grant>
        <!-- see above -->
    </grant>
</grants>

Create a new Grant

Path: POST:/accounts/{id}/grants

Create a new grant

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response body

<grant>
    <!-- see above -->
</grant>

Retrieve a specific Grant

Path: GET:/accounts/{id}/grants/{id}

This feature returns a grant document

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response body

<grant>
    <!-- see above -->
</grant>

Modify a specific Grant

Path: PUT:/accounts/{id}/grants/{id}

This stores the provided grant document as the new grant (re-generating an authtoken, none was provided

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response body

<grant>
    <!-- see above -->
</grant>

Revoke a specific Grant

Path: DELETE:/accounts/{id}/grants/{id}

Deleteds the specific grant, revoking it

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Notifications

Retrieve notifications

Path: GET:/accounts/{id}/notifications

This feature returns notifications that were addressed to the account. By default the response is limited it to the notifications received in the last hour.

Request

Query Argument
Type Description
from (optional) string[] comma separated list of from identifiers to filter by
source (optional) int[]
comma separated list of source id's to filter by
max (optional) int Max number of notifications to retrieve (default: 50)
skip (optional) int Skips the first n notifications (used for pagination). Must be used in conjunction with limit
start (optional) datetime Date range request, start date. Must be used in conjunction with end
end (optional) datetime Date range request, end date. Defaults to now

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response body

<notifications>
    <notification>
        <!-- see above -->
    </notification>
    ...
</notifications>

Post new notification

Path: POST:/accounts/{id}/notifications

Post a new notification to the account. This posts the notification to the implicit source self. For any notification that should be received by a number of accounts, the post should be done against the source on the source owning account, i.e.

POST:/accounts/{id}/sources/{resourceid}/notifications

Request Body

<notification>
    <!-- see above -->
</notification>

Response

Response Response Body Description
Created (201) text/xml
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response Headers

Header Description
Location the location the new notification can be retrieved from
X-Id The unique id of the created notification (used as {resourceid} to construct the Location

Retrieve specific notification

Path: GET:/accounts/{id}/notifications/{resourceid}

This feature provides access to a specific notification that was delivered to the account

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response body

<notification>
    <!-- see above -->
</notification>

 

Sources

Retrieve all Sources for the account

Path: GET:/accounts/{id}/sources

This feature returns all sources owned by the account

Request

Query Argument
Type Description
limit (optional) int Max number of sources to retrieve
skip (optional) int Skips the first n sources (used for pagination). Must be used in conjunction with limit

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response body

<sources>
    <source>
        <!-- see above -->
    </source>
    ...
</sources>

Create a new Source on the account

Path: 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 Response Body Description
Created (201) text/xml
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response Headers

Header Description
Location the location the created source can be retrieved from
X-Id The unique id of the created notification (used as {sourceid} to construct the Location

Retrieve Source Information

Path: GET:/accounts/{id}/sources/{sourceid}

Create a Source with a specific Id or Modify an existing Source

Path: PUT:/accounts/{id}/sources/{sourceid}

Remove an existing Source

Path: DELETE:/accounts/{id}/sources/{sourceid}

Retrieve notifications posted to the Source

Path: GET:/accounts/{id}/sources/{sourceid}/notifications

See GET:/accounts/{id}/notifications

Post new notification to the source

Path: POST:/accounts/{id}/sources/{sourceid}/notifications

See POST:/accounts/{id}/notifications

Retrieve a specific notification posted to the Source

Path: GET:/accounts/{id}/sources/{sourceid}/notifications/{notificationid}

See GET:/accounts/{id}/notifications/{notificationid}

Subscriptions

Retrieve all Source Subscriptions for the account

Path: GET:/accounts/{id}/subscriptions

This feature returns all subscriptions for the account

Request

Query Argument
Type Description
limit (optional) int Max number of sources to retrieve
skip (optional) int Skips the first n subscriptions (used for pagination). Must be used in conjunction with limit

Response

Response Response Body Description
Ok (200) see below
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response body

<subscriptions>
    <subscription>
        <!-- see above -->
    </subscription>
    ...
</subscriptions>

Create a new Subscription for an unknown source

Path: POST:/accounts/{id}/subscriptions

Post a subscription, locating or creating the included source

Request Body

<subscription>
    <!-- the source information for the subscription (locates or creates source) -->
    <source>
        <uri>...</uri>
        ...
    <source>
    ...
    <!-- see above -->
</subscription>

Response

Response Response Body Description
Created (201) text/xml
operation completed successfully
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Response Headers

Header Description
Location the location the created source can be retrieved from
X-Id The unique id of the created notification (used as {sourceid} to construct the Location

Retrieve Subscription Information

Path: GET:/accounts/{id}/subscription/{sourceid}

Create or modify a new Subscription to a source

Path: PUT:/accounts/{id}/subscriptions/{sourceid}

Create or modify a subscription to a source

Request Body

<subscription>
    <!-- see above -->
</subscription>

Response

Response Response Body Description
Ok(200) text/xml
operation completed successfully and a new event was created
Bad Request (400) text/xml request could not be completed, because of invalid data in the request
Unauthorized (401) text/xml Missing or bad authentication
Forbidden (403) text/xml Authenticated user does not have access

Remove an existing Subscription

Path: DELETE:/accounts/{id}/subscription/{sourceid}

Retrieve notifications posted to the Subscription

Path: GET:/accounts/{id}/subscription/{sourceid}/notifications

See GET:/accounts/{id}/notifications

Tags:
 
Images (0)
 
Comments (0)
You must login to post a comment.