Skip to content

Data api authentication authentication

Yuji Takayama edited this page Jul 10, 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.
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.

Status Code

Code Description
200 no error

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