Skip to content

Obtain a token

rkulagowski edited this page Oct 1, 2014 · 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://data2.schedulesdirect.org/20140530/token

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

{"username":"rkulagow@rocketmail.com", "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"
}

TODO: include error responses.

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