En español
NIDA

Menu

Developers API

Revised October 2012

Description

To retrieve all the questions and to evaluate them, the user must need an access token. A request to '/get_token' give a response which includes a token_id.

URL: <URLBASE>/get_token

Logic

Each request creates a new user with a token_id.  All further requests are processed using this token_id. 

Sample Request Format

{
  "key": "qtye456ceger",
  "user": {
            "name": "Ameen",
            "age": "23",
            "sex": "male",
            "interviewer": "Jim",
            "questionnaire_type": 2
          }
}

Params 

key required
name optional
age optional
sex optional
inteviewer optional
questionnaire_type optional. Take values 1 or 2.Default is 1 unless specified
Method 
(GET|POST)

Response

{
  "status": "1",
  "messages": [
    {
      "message": "Success using API"
    }
  ],
  "token_id": 20,
  "name": "ameen",
  "age": "23",
  "sex": "Male",
  "interviewer": "Jim"
}

Response fields

status Status of the API request
errors Errors if any
token_id Further API call need this token_id

 

This page was last updated October 2012

Attention

Due to the lapse in government funding, the information on this web site may not be up to date, transactions submitted via the web site may not be processed, and the agency may not be able to respond to inquiries until appropriations are enacted. Updates regarding government operating status and resumption of normal operations can be found at

Looking for Treatment?

Use the SAMHSA Treatment Locator or 1-800-662-HELP.

Helpline open during government shutdown