POST login/users/login
(Difference between revisions)
Line 1: | Line 1: | ||
− | + | == Description == | |
+ | |||
+ | Creates a sign in for an user given its password and username or e-mail. The user must set a password in order to login. | ||
+ | |||
+ | == Resource URL == | ||
+ | |||
+ | POST https://api.socialidnow.com/v1/marketing/login/users/login | ||
+ | |||
+ | == Parameters == | ||
+ | |||
+ | === JSON Parameters === | ||
+ | |||
+ | {| | ||
+ | ! align="left" width="200px" | username <sup>1</sup> | ||
+ | | width="200px" | optional | ||
+ | | username. | ||
+ | |- | ||
+ | ! align="left" width="200px" | email_address <sup>1</sup> | ||
+ | | width="200px" | optional | ||
+ | | user e-mail. | ||
+ | |- | ||
+ | ! align="left" width="200px" | password | ||
+ | | width="200px" | required | ||
+ | | user password. | ||
+ | |} | ||
+ | |||
+ | <sup>1</sup> At least one of these fields must be given to identify the user. | ||
+ | |||
+ | == Authentication == | ||
+ | |||
+ | This API requires Social Login App authentication. See [[Authentication]]. | ||
+ | |||
+ | == Response == | ||
+ | |||
+ | ==== Response Status ==== | ||
+ | {| | ||
+ | ! align="left" width="200px" | created (201) | ||
+ | | The sign in was created successfully. | ||
+ | |- | ||
+ | ! align="left" width="200px" | bad_request (400) | ||
+ | | Some required parameter was not informed. | ||
+ | |- | ||
+ | ! align="left" width="200px" | unauthorized (401) | ||
+ | | The authentication is wrong. See [[Authentication]]. | ||
+ | |- | ||
+ | ! align="left" width="200px" | forbidden (403) | ||
+ | | The combination of password and username or email_address is invalid or the user is deactivated. | ||
+ | |- | ||
+ | ! align="left" width="200px" | internal_server_error (500) | ||
+ | | An unknown error happened. | ||
+ | |} | ||
+ | |||
+ | == Examples == | ||
+ | |||
+ | === Using username and password === | ||
+ | |||
+ | ==== Request ==== | ||
+ | |||
+ | curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/login' \ | ||
+ | -d '{ | ||
+ | "username": "new_user", | ||
+ | "password": "new_user_secret" | ||
+ | }' \ | ||
+ | -H 'Content-type: application/json' \ | ||
+ | --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf | ||
+ | |||
+ | ==== Response ==== | ||
+ | |||
+ | ===== Response Headers ===== | ||
+ | |||
+ | HTTP/1.1 201 Created | ||
+ | Location: https://api.socialidnow.com/v1/marketing/login/sign_ins/9678 | ||
+ | Status: 201 | ||
+ | |||
+ | ===== Response Body ===== | ||
+ | |||
+ | { | ||
+ | "connection":"https://api.socialidnow.com/v1/marketing/login/connections/f6a13b09cf19ce1b9eaf849d59f220250210b5c44c10c71033d253de8b61ed9b", | ||
+ | "connection_id":"f6a13b09cf19ce1b9eaf849d59f220250210b5c44c10c71033d253de8b61ed9b", | ||
+ | "login_token":"658cd5300e49d2834ffab3c3c9103b71a5075a9cda4621df56b4d59cffbaec08", | ||
+ | "user_id":341 | ||
+ | } | ||
+ | |||
+ | === Using email_address and password === | ||
+ | |||
+ | ==== Request ==== | ||
+ | |||
+ | curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/login' \ | ||
+ | -d '{ | ||
+ | "email_address": "new_user@user_domain.com", | ||
+ | "password": "new_user_secret" | ||
+ | }' \ | ||
+ | -H 'Content-type: application/json' \ | ||
+ | --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf | ||
+ | |||
+ | ==== Response ==== | ||
+ | |||
+ | ===== Response Headers ===== | ||
+ | |||
+ | HTTP/1.1 201 Created | ||
+ | Location: https://api.socialidnow.com/v1/marketing/login/sign_ins/9678 | ||
+ | Status: 201 | ||
+ | |||
+ | ===== Response Body ===== | ||
+ | |||
+ | { | ||
+ | "connection":"https://api.socialidnow.com/v1/marketing/login/connections/f6a13b09cf19ce1b9eaf849d59f220250210b5c44c10c71033d253de8b61ed9b", | ||
+ | "connection_id":"f6a13b09cf19ce1b9eaf849d59f220250210b5c44c10c71033d253de8b61ed9b", | ||
+ | "login_token":"658cd5300e49d2834ffab3c3c9103b71a5075a9cda4621df56b4d59cffbaec08", | ||
+ | "user_id":341 | ||
+ | } |
Revision as of 03:19, 4 November 2014
Contents |
Description
Creates a sign in for an user given its password and username or e-mail. The user must set a password in order to login.
Resource URL
POST https://api.socialidnow.com/v1/marketing/login/users/login
Parameters
JSON Parameters
username 1 | optional | username. |
---|---|---|
email_address 1 | optional | user e-mail. |
password | required | user password. |
1 At least one of these fields must be given to identify the user.
Authentication
This API requires Social Login App authentication. See Authentication.
Response
Response Status
created (201) | The sign in was created successfully. |
---|---|
bad_request (400) | Some required parameter was not informed. |
unauthorized (401) | The authentication is wrong. See Authentication. |
forbidden (403) | The combination of password and username or email_address is invalid or the user is deactivated. |
internal_server_error (500) | An unknown error happened. |
Examples
Using username and password
Request
curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/login' \ -d '{ "username": "new_user", "password": "new_user_secret" }' \ -H 'Content-type: application/json' \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response
Response Headers
HTTP/1.1 201 Created Location: https://api.socialidnow.com/v1/marketing/login/sign_ins/9678 Status: 201
Response Body
{ "connection":"https://api.socialidnow.com/v1/marketing/login/connections/f6a13b09cf19ce1b9eaf849d59f220250210b5c44c10c71033d253de8b61ed9b", "connection_id":"f6a13b09cf19ce1b9eaf849d59f220250210b5c44c10c71033d253de8b61ed9b", "login_token":"658cd5300e49d2834ffab3c3c9103b71a5075a9cda4621df56b4d59cffbaec08", "user_id":341 }
Using email_address and password
Request
curl -iX POST 'https://api.socialidnow.com/v1/marketing/login/users/login' \ -d '{ "email_address": "new_user@user_domain.com", "password": "new_user_secret" }' \ -H 'Content-type: application/json' \ --user 138:e8b9ca24f1b590af67e6271297d6e1f7226625d61c5b5daa1b2f215464e292cf
Response
Response Headers
HTTP/1.1 201 Created Location: https://api.socialidnow.com/v1/marketing/login/sign_ins/9678 Status: 201
Response Body
{ "connection":"https://api.socialidnow.com/v1/marketing/login/connections/f6a13b09cf19ce1b9eaf849d59f220250210b5c44c10c71033d253de8b61ed9b", "connection_id":"f6a13b09cf19ce1b9eaf849d59f220250210b5c44c10c71033d253de8b61ed9b", "login_token":"658cd5300e49d2834ffab3c3c9103b71a5075a9cda4621df56b4d59cffbaec08", "user_id":341 }