If you don't know what API stands for, you should probably just skip right past this section. The content here is heavily leaning to the technical side. You have been warned.
For those of you still here, the below content can be used as a starting point for your API calls.
Admin Module API Documentation
## Example API Calls
Below are some example API calls:
### Get status of the survey
Request
```http
POST /Test Survey/cgi-bin/admin.pl HTTP/1.1
Host: localhost:61501
Content-Type: application/x-www-form-urlencoded
Content-Length: 72
studyname=aca&username=admin&password=SawtoothSamples%2B1&hid_api=status
```
Response
```http
{
"completes": 0,
"incompletes": 26,
"disqualifieds": 0,
"quotas": []
}
```
### Initialize survey
#### Request
hid_api=apply_changes
```http
POST /Test Survey/cgi-bin/admin.pl HTTP/1.1
Host: localhost:61501
Content-Type: application/x-www-form-urlencoded
Content-Length: 79
studyname=aca&username=admin&password=SawtoothSamples%2B1&hid_api=apply_changes
```
#### Response
```http
{
"result": true,
"finished": true
}
```
### Reset survey
#### Request
hid_api=reset_survey
```http
POST /Test Survey/cgi-bin/admin.pl HTTP/1.1
Host: localhost:61501
Content-Type: application/x-www-form-urlencoded
Content-Length: 78
studyname=aca&username=admin&password=SawtoothSamples%2B1&hid_api=reset_survey
```
#### Response
```http
{
"result": true,
"finished": true
}
```
### Check for data table conflicts
#### Request
hid_api=setup_check
```http
POST /Test Survey/cgi-bin/admin.pl HTTP/1.1
Host: localhost:61501
Content-Type: application/x-www-form-urlencoded
Content-Length: 77
studyname=aca&username=admin&password=SawtoothSamples%2B1&hid_api=setup_check
```
#### Response
No conflicts
```http
{
"result": true
}
```
### Close or reopen survey
#### Request
hid_api=pause or hid_api=unpause
```http
POST /Test Survey/cgi-bin/admin.pl HTTP/1.1
Host: localhost:61501
Content-Type: application/x-www-form-urlencoded
Content-Length: 71
studyname=aca&username=admin&password=SawtoothSamples%2B1&hid_api=pause
```
#### Response
```http
{}
```
### Delete data tables
#### Request
hid_api=delete_db_tables
```http
POST /Test Survey/cgi-bin/admin.pl HTTP/1.1
Host: localhost:61501
Content-Type: application/x-www-form-urlencoded
Content-Length: 82
studyname=aca&username=admin&password=SawtoothSamples%2B1&hid_api=delete_db_tables
```
#### Response
```http
{
"result": true
}
```