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://sampleurl.com/

eg - http://sampleurl.com/example

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

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