Services/F1/Server/API: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 60: Line 60:


All APIs require POST and part of the post data must be the account object that was received via the account_tokens cookie (see the verify endpoint above).
All APIs require POST and part of the post data must be the account object that was received via the account_tokens cookie (see the verify endpoint above).
All api's return a json object with the following format:
{
result: {} | NULL
error: {} | NULL
}
If the result is valid, error will be NULL, and if there is an error, result will be NULL.
The error object consists of the following data:
{
'status': status code, integer
'provider': domain of the service provider
'message': text message, not necessarily usable for UI
}
The status codes generally follow HTTP status codes.
==== POST /send ====
The send API is used to share a link to a service.
Request Arguments:
*domain (string): Domain of service to share to (google.com for gmail, facebook.com, twitter.com)
*username (string): Optional username, required if more than one account is configured for a domain.
*userid (string): Optional userid, required if more than one account is configured for a domain.
*account (object): json formatted account object retrieved during OAuth authorization
*link (string): URL to share
*message (string): Message entered by user
*shorturl (string): Shortened version of URL to share
*shorten (boolean): Force a shortening of the URL provided
*to (string): Individual or group to share with, not supported by all services.
*subject (string): Subject line for emails, not supported by all services.
*picture (string): URL to publicly available thumbnail, not supported by all services.
*picture_base64 (string): Base 64 encoded PNG version of the picture used for attaching to emails.
*description (string): Site provided description of the shared item, not supported by all services.
Any number of other parameters may be sent.  They will be silently dropped by any given service implementation if the parameter is not understood.
Success Results:
Error Results:
200: ok, message sent, response object in body
202: message has been queued, client must call response api to find the result
401: authorization required (e.g. oauth tokens may be expired)
502: remote service (e.g. twitter) is temporarily unavailable, try again later
503: share service is temporarily unavailable
==== POST /contacts ====
The contacts api is used to retrieve the users contacts for a given service.  The contacts are used to provide direct sharing functionality.
==== GET /response ====
Confirmed users
169

edits

Navigation menu