Authentication V.1¶
Get an authentication token
GET¶
- DESCRIPTION
- Retrieve authentication token to use aftermath in authenticated calls
- URL STRUCTURE
https://www.example.com/api/<version>/auth
version: API version. extension: json param username: user to authenticate param password: user’s password - VERSIONS
- v1
- ERRORS
200: Ok 403: Forbidden - EXAMPLES
Examples¶
POST user and password with http¶
$ http --pretty all -jv POST localhost:5000/api/v1/auth 'username=test' 'password=password' POST /api/v1/auth HTTP/1.1 Accept: application/json Accept-Encoding: gzip, deflate, compress Content-Length: 44 Content-Type: application/json; charset=utf-8 Host: localhost:5000 User-Agent: HTTPie/0.6.0 { "password": "password", "username": "test" } HTTP/1.1 404 Not Found Content-Length: 93 Content-Type: application/json Date: Mon, 29 Jun 2015 14:40:05 GMT Vary: X-Auth-Token { "error": { "code": 404, "message": "The resource could not be found.", "title": "Not Found" } }
POST user and password with curl¶
$ curl -X POST -H 'Content-Type: application/json' -d '{ "username": "test", "password": "password" }' http://localhost:5000/api/v1/auth % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 140 100 93 100 47 24218 12239 --:--:-- --:--:-- --:--:-- 46500 {"error": {"message": "The resource could not be found.", "code": 404, "title": "Not Found"}}
POST wrong user and password with http¶
$ http --pretty all -jv POST localhost:5000/api/v1/auth 'username=test' 'password=wrong_password' POST /api/v1/auth HTTP/1.1 Accept: application/json Accept-Encoding: gzip, deflate, compress Content-Length: 50 Content-Type: application/json; charset=utf-8 Host: localhost:5000 User-Agent: HTTPie/0.6.0 { "password": "wrong_password", "username": "test" } HTTP/1.1 404 Not Found Content-Length: 93 Content-Type: application/json Date: Mon, 29 Jun 2015 14:40:05 GMT Vary: X-Auth-Token { "error": { "code": 404, "message": "The resource could not be found.", "title": "Not Found" } }