Labs/Weave/User/API: Difference between revisions

From MozillaWiki
< Labs‎ | Weave
Jump to navigation Jump to search
(initial stab at a spec)
 
mNo edit summary
Line 48: Line 48:
|- valign="top"
|- valign="top"
| captcha-challenge
| captcha-challenge
| The challenge string from the captcha (see miscellaneous functions below)
| The challenge string from the captcha (see [Misc miscellaneous functions] below)
|- valign="top"
|- valign="top"
| captcha-response
| captcha-response

Revision as of 23:05, 26 March 2009

Weave User API v0.1

Release Date: TBD


All data passed into the User API should be utf-8 encoded.

URL Semantics

User account URLs follow, for the most part, REST semantics. Request and response bodies are all JSON-encoded.

Certain functions use HTTP basic auth (over SSL, so as to maintain password security). If the auth username does not match the username in the path, the server will issue an Error Response

The Weave User API has a set of Weave Response Codes to cover errors in the request or on the server side. The format of a successful response is defined in the appropriate request method section.

GET

https://server/user/1/username/

Returns 1 if the username is in use, 0 if it is available.

https://server/user/1/username/chkWeaveNode

Returns the Weave Node that the client is located on. Weave-specific calls should be directed to that node.


PUT

https://server/user/1/username/

Requests that an account be created for username.

The JSON payload should include

Field Description
password The password to be associated with the account.
invite-code A Weave invite code
email Email address associated with the account
captcha-challenge The challenge string from the captcha (see [Misc miscellaneous functions] below)
captcha-response The response to the captcha

The server will return the username on success, or an error message if some portion of the process fails.


https://server/user/1/username/email

NOTE: Requires simple authentication with the username and password associated with the account. The auth username must match the username in the path.

Changes the email address associated with the account to the value specified in the payload.

The server will return the new email address on success, or an error message if some portion of the process fails.


https://server/user/1/username/password

NOTE: Requires simple authentication with the username and (current) password associated with the account. The auth username must match the username in the path.

Changes the password associated with the account to the value specified in the payload.

The server will return 1 on success, or an error message if some portion of the process fails.


DELETE

https://server/user/1/username/

NOTE: Requires simple authentication with the username and password associated with the account. The auth username must match the username in the path.

Deletes the user account.


X-Weave-Alert

This header may be sent back from any transaction, and contains potential warning messages, information, or other alerts. The contents are intended to be human-readable.