En español
NIDA

Menu

Developers API

Revised October 2012

URLs

Each module is contained within a folder which identifies its function group.
<URL_BASE>/<ACTION>
Base URL -    http://www.drugabuse.gov/qm/

eg - http://www.drugabuse.gov/qm/get_token?key=MYAPIKEY

Note: You must register and generate an API Key before you will be able to use the API.

Response Format

Modules can be called with GET or POST methods and will return JSONP formatted responses in plain text through HTTP. 
All output from the service will contain a status and data


   "status":"0",
   "messages" : [
        {
            "message": "Sample message one",
            "more_info_text" : "Sample text one",
            "more_info_link" : "link one"
        },
                {
            "message": "Sample message two",
            "more_info_text" : "Sample text two",
            "more_info_link" : "link two"
        }
   ],
   "errors" : [
       {
           "message" : "Sample error one"
       },
       {
           "message" : "Sample error two"
       }  
   ]     
   


Status Codes
Status Description Notes 
1 success normal response, no input errors
0 input error input parameters missing or in invalid format
-1 internal error unexpected internal error

Questionnaire Types

API handles the response in two different ways.
  • Type 1: Questions across each sub question.
  • Type 2: Sub question across each question.

 

In an ongoing effort to implement the Federal Digital Strategy, NIDA is connecting Web site editors and developers with the tools they need to host and share the Government’s reliable drug abuse research and prevention information.

This page was last updated October 2012