-
Notifications
You must be signed in to change notification settings - Fork 25
Self Registration
This API should be used to get the Terms of Service if they are going to be displayed to the user as well as the public key for the ReCaptcha widget.
registration/read
Anyone may call this API.
POST /app/registration/read HTTP/1.1
Host: dev.ohmage.org
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7
Content-Length: byte-length-of-content
Content-Type: application/x-www-form-urlencoded
curl -v http://localhost:8080/app/registration/read
{
"result" : "success",
"data" : {
"terms_of_service" : "<Terms of Service>",
"recaptcha_public_key" : "<ReCaptcha Public Key>"
}
}
See the error page for a description of error codes and their associated descriptions.
This creates a new, disabled account. The account must then be activated via user/activation.
user/register
Anyone may call this API.
- (r) username = The new user's username.
- (r) password = The new user's plaintext password.
- (r) email_address = The new user's email address.
- (r) recaptcha_challenge_field = The challenge field generated by the ReCaptcha widget.
- (r) recaptcha_response_field = The response field generated by the ReCaptcha widget that is the user's response to the challenge.
POST /app/user/register HTTP/1.1
Host: dev.ohmage.org
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7
Content-Length: byte-length-of-content
Content-Type: application/x-www-form-urlencoded
username=new.user
&password=new.password
&[email protected]
&recaptcha_challenge_field=83w8oh4wh7kwh489jq3l9j3l48h8l2h4l
&recaptcha_response_field=YeOldeAnswer
curl -v -d "username=new.user&password=new.password&[email protected]&recaptcha_challenge_field=83w8oh4wh7kwh489jq3l9j3l48h8l2h4l&recaptcha_response_field=YeOldeAnswer" http://localhost:8080/app/user/register
{
"result" : "success"
}
Along with the success result, the user will receive an email at the supplied email address which will have an activation link.
See the error page for a description of error codes and their associated descriptions.
Activates an account that was recently registered. Users have a limited time to click the activation link before their activation request is no longer valid.
user/activate
Anyone may call this API, and it is expected that the caller is doing so from a link in an email.
- (r) registration_id = The registration ID sent in the link to the user.
POST /app/user/activate HTTP/1.1
Host: dev.ohmage.org
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7
Content-Length: byte-length-of-content
Content-Type: application/x-www-form-urlencoded
registration_id=76e87c6de788ef54d4c536de55fdeduefede54e54d34de32c45de34d56f58e709dc9e90
curl -v -d "registration_id=76e87c6de788ef54d4c536de55fdeduefede54e54d34de32c45de34d56f58e709dc9e900" http://localhost:8080/app/user/activate
{
"result" : "success"
}
See the error page for a description of error codes and their associated descriptions.
Given a username and email address, this will reset the user's password. If the username and email address match, an email with a new, temporary password will be sent to the user. The next time they attempt to login with that password, it will prompt them to change it. If the user doesn't exist or the email address and username don't match up, "success" will still be returned because this call doesn't require authentication, and we don't want someone to be able to spam out server for email addresses.
user/reset_password
Anyone may call this API. The username must match a user's username exactly, but the email address will be case insensitive.
- (r) username = The username of the user whose password is to be reset.
- (r) email_address = The email address of the user whose password is to be reset.
POST /app/user/reset_password HTTP/1.1
Host: dev.ohmage.org
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7
Content-Length: byte-length-of-content
Content-Type: application/x-www-form-urlencoded
username=test.user
[email protected]
curl -v -d "username=test.user&[email protected]" http://localhost:8080/app/user/reset_password
{
"result" : "success"
}
See the error page for a description of error codes and their associated descriptions.