This method will accept user credentials and return information about the user (if the details are correct) along with an API token which can be used.
This method must be sent with an X-Auth-Application
header. You do not need to sent any other authentication headers with this request.
/api/v2/authentication/authenticate
username
- the user's usernamepassword
- the user's passwordtwo_factor_code
- the user's two factor authentication code (if using two factor authentication)account
- the account from which you wish to search (optional, if you do not send an account parameter, the system will return an array of all users which match those credentials - see below).This method will return a hash with a status
of 'Authenticated' along with an array of all authenticated users
along with their API tokens and the account they belong to. The users
array will only include users where API access has been enabled by an administrator.
{
"status": "Authenticated",
"users": [
{
"id": 6,
"username": "adam",
"first_name": "Adam",
"last_name": "Cooke",
"email_address": "adam@atechmedia.com",
"time_zone": "London",
"created_at": "2012-01-12T22:09:01+00:00",
"activated?": true,
"invite_code": null,
"permissions": {
"admin": true,
"reporting": true,
"tickets": true,
"api": true
},
"account": {
"name": "aTech Media",
"permalink": "atech",
"domain": "atech.sirportly.com",
"domain_with_protocol": "https://atech.sirportly.com",
"enabled": true
},
"api_token": {
"token": "[token here]",
"secret": "[secret here]"
}
},
{
"id": 36,
"username": "adam",
"first_name": "Adam",
"last_name": "Cooke",
"email_address": "adam@atechmedia.com",
"time_zone": "London",
"created_at": "2012-02-01T16:07:56+00:00",
"activated?": true,
"invite_code": null,
"permissions": {
"admin": true,
"reporting": true,
"tickets": true,
"api": true
},
"account": {
"name": "Fibreband Ltd",
"permalink": "fibreband",
"domain": "fibreband.sirportly.com",
"domain_with_protocol": "https://fibreband.sirportly.com",
"enabled": true
},
"api_token": {
"token": "[token here]",
"secret": "[secret here]"
}
}
]
}
This method will return a hash with a status
of 'Authenticated' along with the details of the authenticated user.
{
"status": "Authenticated",
"user": {
"id": 6,
"username": "adam",
"first_name": "Adam",
"last_name": "Cooke",
"email_address": "adam@atechmedia.com",
"time_zone": "London",
"created_at": "2012-01-12T22:09:01+00:00",
"activated?": true,
"invite_code": null,
"permissions": {
"admin": true,
"reporting": true,
"tickets": true,
"api": true
},
"account": {
"name": "aTech Media",
"permalink": "atech",
"domain": "atech.sirportly.com",
"domain_with_protocol": "https://atech.sirportly.com",
"enabled": true
},
"api_token": {
"token": "[token here]",
"secret": "[secret here]"
}
}
}
If you attempt to authenticate a user and pass an account
parameter but the user is not permitted to use the API you will receive the response below. An administrator of the account can enable it for them (it is disabled by default).
{
"status": "APIAccessDisabled"
}
This method will return a hash with a status
of 'InvalidCredentials' along with the credentials and permalink of the account we received.
{
"status": "InvalidCredentials",
"username": "jogn",
"password": "invalidpassword",
"account": "acme"
}
This method will return a hash with a status
of 'TwoFactorRequired'.
{
"status": "TwoFactorRequired"
}
This method will return a hash with a status
of 'InvalidTwoFactorCode'.
{
"status": "InvalidTwoFactorCode"
}
This method will return a hash with a status
of 'TwoFactorLocked'.
{
"status": "TwoFactorLocked"
}
This method will return a hash with an error
of 'NotPermittedFromIPAddress', along with the ip
- the ip address the authentication attempt was made from.
{
"error": "NotPermittedFromIPAddress",
"ip": "127.0.0.1"
}
This method will return a hash with an error
of 'AccountNotFound', along with a message
containing the permalink of the account received.
{
"error": "AccountNotFound",
"message": "No account found matching 'acme'"
}