Data api authentication authentication

Taku AMANO edited this page Jul 18, 2013 · 5 revisions

Authentication: authentication

Create new session and access token. This is like login.

Request

HTTP Request

This method accepts POST only.

POST https://your-host/your-mt-api.cgi/v1/authentication

Parameters

Method Parameters

Not available.

Query Parameters

Not available.

Request Body

Parameter Type Description
username string The username to authenticate.
password string The password of the user.
remember boolean If true (generally, "1" is specified.), a new session will be created as a persistent session. If you want to specify false, you can pass "" or "0" to this parameter.
clientId string This is not required if you specify session id via "X-MT-Authorization" request header. You can create new access token if you have a session id related to this clientId, although you do not have an access token.
mtDataApiLoginMagicToken string This is not required if you authenticate except via browser. If this parameter is passed and valid the MT will set cookie in order to start a session.

Response

Parameter Type Description
sessionId string Session ID. This value is included only when mtDataApiLoginMagicToken is not passed. If mtDataApiLoginMagicToken is passed (and is valid value), sessionId is stored in httponly-cookie.
accessToken string Access token
expiresIn unsigned integer This access token will be invalidated automatically after the number of seconds specified here.
remember boolean If true, a new session has been created as a persistent session.

Status Code

Code Description
200 no error
401 Invalid login

Example

POST /mt-api.cgi/v1/authentication
Host: www.example.com

HTTP/1.0 200 OK
Content-Type: application/json
Content-length: ...
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.