Difference between revisions of "API:POST /activate"

From SoFurry
Jump to: navigation, search
(Created page with "= Resource URL = https://api.sofurrybeta.com/activate = Request = POST /activate { // Required, 8 characters "activate_token": "abcd1234" } = Response: Success =...")
 
(Response: Failed Validation)
 
(2 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
  POST /activate
 
  POST /activate
 
  {
 
  {
  // Required, 8 characters
+
   "activate_token": "abcd1234" # Required, 8 characters
   "activate_token": "abcd1234"
 
 
  }
 
  }
  
Line 21: Line 20:
 
If the result is TRUE, then the activation was a success. The corresponding user will now be able to log in with their username and password.
 
If the result is TRUE, then the activation was a success. The corresponding user will now be able to log in with their username and password.
  
= Response: Failed Login =
+
= Response: Failed Validation =
 +
 
 +
Examples of the failure response messages you'll see.
 +
 
 +
If the activate_token field is not supplied:
 +
 
 +
HTTP 422
 +
{
 +
  "activate_token": [
 +
    "The activate token field is required."
 +
  ]
 +
}
 +
 
 +
If the token is too short or too long:
 +
 
 +
HTTP 422
 +
{
 +
  "activate_token": [
 +
    "The activate token must be 8 characters."
 +
  ]
 +
}
 +
 
 +
If the token cannot be identified in the database - note that once a token is used, it's cleared:
  
 
  HTTP 422
 
  HTTP 422
 
  {
 
  {
   "result": false,
+
   "activate_token": [
  "message": "Incorrect username or password"
+
    "The selected activate token is invalid."
 +
  ]
 
  }
 
  }
  
  
 
[[Category:API]]
 
[[Category:API]]

Latest revision as of 12:50, 25 April 2016

Resource URL

https://api.sofurrybeta.com/activate

Request

POST /activate
{
  "activate_token": "abcd1234" # Required, 8 characters
}

Response: Success

HTTP 200
{
  "result": true,
  "token": "Activated! Go ahead and log in."
}

If the result is TRUE, then the activation was a success. The corresponding user will now be able to log in with their username and password.

Response: Failed Validation

Examples of the failure response messages you'll see.

If the activate_token field is not supplied:

HTTP 422
{
  "activate_token": [
    "The activate token field is required."
  ]
}

If the token is too short or too long:

HTTP 422
{
  "activate_token": [
    "The activate token must be 8 characters."
  ]
}

If the token cannot be identified in the database - note that once a token is used, it's cleared:

HTTP 422
{
  "activate_token": [
    "The selected activate token is invalid."
  ]
}