Skip to content

Obtain a token

Robert Kulagowski edited this page Jun 3, 2016 · 7 revisions

This is the first thing your client must do; almost all commands require a token in the header.

A token is considered invalid if any of the following occurs

  • 24 hours elapse since the token was first granted
  • A new token is requested

POST https://json.schedulesdirect.org/20141201/token

with the body (click the "Raw" button) of the POST being:

{"username":"[email protected]", "password":"sha1hexpassword"}

The password field is the sha1_hex hash of the user's password, resulting in a 40-character string being passed to the server. The hash must be sent in lowercase.

Response:

The server will respond with one of the following:

{
    "code": 0,
    "message": "OK",
    "serverID": "AWS-SD-web.1",
    "token": "f3fca79989cafe7dead71beefedc812b"
}

If the system is down, you will receive:

{
    "response": "SERVICE_OFFLINE",
    "code": 3000,
    "serverID": "20141201.web.1",
    "message": "Server offline for maintenance.",
    "datetime": "2015-04-23T00:03:32Z",
    "token": "CAFEDEADBEEFCAFEDEADBEEFCAFEDEADBEEFCAFE"
}

If the service is offline you should disconnect and retry in 30 minutes.

The "token" must be passed to the server as part of the header for all requests.

In the following examples, where you see Token: Required you must send the token in the header. In POSTman, click "Headers". Set the Header field to "token" (no quotes, lowercase) and the Value field to the token that you retrieved.

Clone this wiki locally