curl --request POST \
--url https://web.edcontrols.com/api/v2/data/audittemplates/{database} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"groupId": "<string>",
"isPublished": false,
"auditType": "area",
"tags": [
"<string>"
],
"answeredStatusEnabled": true,
"questions": [
{
"categoryName": "<string>",
"questions": [
{
"question": "<string>",
"settings": {
"answer": [
"<string>"
],
"richOptions": [
{
"id": "<string>",
"text": "<string>",
"image": "<string>"
}
],
"ticketRequired": true,
"isAttachmentMandatory": true,
"attachments": [
"<string>"
],
"weightingfactor": 123,
"styling": {
"options": {}
}
},
"answer": [
"<unknown>"
],
"ticket": [
"<string>"
],
"description": "<string>"
}
],
"settings": {
"duplicate": true
}
}
],
"_attachments": {}
}
'import requests
url = "https://web.edcontrols.com/api/v2/data/audittemplates/{database}"
payload = {
"name": "<string>",
"groupId": "<string>",
"isPublished": False,
"auditType": "area",
"tags": ["<string>"],
"answeredStatusEnabled": True,
"questions": [
{
"categoryName": "<string>",
"questions": [
{
"question": "<string>",
"settings": {
"answer": ["<string>"],
"richOptions": [
{
"id": "<string>",
"text": "<string>",
"image": "<string>"
}
],
"ticketRequired": True,
"isAttachmentMandatory": True,
"attachments": ["<string>"],
"weightingfactor": 123,
"styling": { "options": {} }
},
"answer": ["<unknown>"],
"ticket": ["<string>"],
"description": "<string>"
}
],
"settings": { "duplicate": True }
}
],
"_attachments": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
groupId: '<string>',
isPublished: false,
auditType: 'area',
tags: ['<string>'],
answeredStatusEnabled: true,
questions: [
{
categoryName: '<string>',
questions: [
{
question: '<string>',
settings: {
answer: ['<string>'],
richOptions: [{id: '<string>', text: '<string>', image: '<string>'}],
ticketRequired: true,
isAttachmentMandatory: true,
attachments: ['<string>'],
weightingfactor: 123,
styling: {options: {}}
},
answer: ['<unknown>'],
ticket: ['<string>'],
description: '<string>'
}
],
settings: {duplicate: true}
}
],
_attachments: {}
})
};
fetch('https://web.edcontrols.com/api/v2/data/audittemplates/{database}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://web.edcontrols.com/api/v2/data/audittemplates/{database}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'groupId' => '<string>',
'isPublished' => false,
'auditType' => 'area',
'tags' => [
'<string>'
],
'answeredStatusEnabled' => true,
'questions' => [
[
'categoryName' => '<string>',
'questions' => [
[
'question' => '<string>',
'settings' => [
'answer' => [
'<string>'
],
'richOptions' => [
[
'id' => '<string>',
'text' => '<string>',
'image' => '<string>'
]
],
'ticketRequired' => true,
'isAttachmentMandatory' => true,
'attachments' => [
'<string>'
],
'weightingfactor' => 123,
'styling' => [
'options' => [
]
]
],
'answer' => [
'<unknown>'
],
'ticket' => [
'<string>'
],
'description' => '<string>'
]
],
'settings' => [
'duplicate' => true
]
]
],
'_attachments' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://web.edcontrols.com/api/v2/data/audittemplates/{database}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"groupId\": \"<string>\",\n \"isPublished\": false,\n \"auditType\": \"area\",\n \"tags\": [\n \"<string>\"\n ],\n \"answeredStatusEnabled\": true,\n \"questions\": [\n {\n \"categoryName\": \"<string>\",\n \"questions\": [\n {\n \"question\": \"<string>\",\n \"settings\": {\n \"answer\": [\n \"<string>\"\n ],\n \"richOptions\": [\n {\n \"id\": \"<string>\",\n \"text\": \"<string>\",\n \"image\": \"<string>\"\n }\n ],\n \"ticketRequired\": true,\n \"isAttachmentMandatory\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"weightingfactor\": 123,\n \"styling\": {\n \"options\": {}\n }\n },\n \"answer\": [\n \"<unknown>\"\n ],\n \"ticket\": [\n \"<string>\"\n ],\n \"description\": \"<string>\"\n }\n ],\n \"settings\": {\n \"duplicate\": true\n }\n }\n ],\n \"_attachments\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://web.edcontrols.com/api/v2/data/audittemplates/{database}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"groupId\": \"<string>\",\n \"isPublished\": false,\n \"auditType\": \"area\",\n \"tags\": [\n \"<string>\"\n ],\n \"answeredStatusEnabled\": true,\n \"questions\": [\n {\n \"categoryName\": \"<string>\",\n \"questions\": [\n {\n \"question\": \"<string>\",\n \"settings\": {\n \"answer\": [\n \"<string>\"\n ],\n \"richOptions\": [\n {\n \"id\": \"<string>\",\n \"text\": \"<string>\",\n \"image\": \"<string>\"\n }\n ],\n \"ticketRequired\": true,\n \"isAttachmentMandatory\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"weightingfactor\": 123,\n \"styling\": {\n \"options\": {}\n }\n },\n \"answer\": [\n \"<unknown>\"\n ],\n \"ticket\": [\n \"<string>\"\n ],\n \"description\": \"<string>\"\n }\n ],\n \"settings\": {\n \"duplicate\": true\n }\n }\n ],\n \"_attachments\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v2/data/audittemplates/{database}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"groupId\": \"<string>\",\n \"isPublished\": false,\n \"auditType\": \"area\",\n \"tags\": [\n \"<string>\"\n ],\n \"answeredStatusEnabled\": true,\n \"questions\": [\n {\n \"categoryName\": \"<string>\",\n \"questions\": [\n {\n \"question\": \"<string>\",\n \"settings\": {\n \"answer\": [\n \"<string>\"\n ],\n \"richOptions\": [\n {\n \"id\": \"<string>\",\n \"text\": \"<string>\",\n \"image\": \"<string>\"\n }\n ],\n \"ticketRequired\": true,\n \"isAttachmentMandatory\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"weightingfactor\": 123,\n \"styling\": {\n \"options\": {}\n }\n },\n \"answer\": [\n \"<unknown>\"\n ],\n \"ticket\": [\n \"<string>\"\n ],\n \"description\": \"<string>\"\n }\n ],\n \"settings\": {\n \"duplicate\": true\n }\n }\n ],\n \"_attachments\": {}\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"_rev": "<string>",
"name": "<string>",
"groupId": "<string>",
"group": "<string>",
"project": "<string>",
"isPublished": true,
"archived": "<string>",
"auditType": "<string>",
"answeredStatusEnabled": true,
"tags": [
"<string>"
],
"dates": {
"creationDate": "2023-11-07T05:31:56Z",
"lastModifiedDate": "2023-11-07T05:31:56Z"
},
"author": {
"email": "jsmith@example.com",
"type": "<string>"
},
"lastmodifier": {
"email": "jsmith@example.com",
"type": "<string>"
},
"versionInfo": {},
"_attachments": {},
"questions": [
{
"categoryName": "<string>",
"questions": [
{
"question": "<string>",
"settings": {
"answertype": "yesnona",
"choice": "single",
"answer": [
"<string>"
],
"richOptions": [
{
"id": "<string>",
"type": "textselect",
"text": "<string>",
"image": "<string>"
}
],
"ticketRequired": true,
"isAttachmentMandatory": true,
"attachments": [
"<string>"
],
"weightingfactor": 123,
"styling": {
"options": {}
}
},
"answer": [
"<unknown>"
],
"ticket": [
"<string>"
],
"description": "<string>"
}
],
"settings": {
"duplicate": true
}
}
]
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}Create an audit template
Creates an audit template in a project.
Only name and groupId are required. The server fills the rest with a
shape the Ed Controls editor opens cleanly: type, project, author,
lastmodifier, dates, participants, versionInfo, an empty
_attachments, auditType: area, and isPublished: false unless you
say otherwise.
groupId is mandatory and must name an existing, non-deleted
template group in the same project. The
Ed Controls editor refuses to save a template that has no group, so a
template created without one would be readable through this API and
impossible to edit in the app. group — the group’s display name — is
derived from that group and ignored if you send it.
The response body is the stored document. Use its _id with the by-id
read endpoint and with the update and delete endpoints — not the
composite {database}|{couchDbId} that the list endpoints return.
Authorization is evaluated before the request body, so a caller without
a qualifying role receives 403 whatever the body contains. A
well-formed JSON object that violates a field constraint is rejected
with 422 and an application/problem+json body whose detail names
the offending path, for example
questions[0].questions[2].settings.duplicate is a category setting and cannot be set on a question. A body that is not a JSON object is 400.
Requires the service account to be Accountable or Support on the project, or a contract admin.
Two URL shapes. This endpoint also answers on
POST /api/v2/data/projects/{database}/audittemplates, which is the
canonical shape — the database sits where every project-scoped read
already puts it, so you do not have to remember that it moves to the
other side of the resource name for a write. One handler answers both
paths, so they cannot behave differently, and both are supported
indefinitely.
See Create an audit template for the question types and the traps.
curl --request POST \
--url https://web.edcontrols.com/api/v2/data/audittemplates/{database} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"groupId": "<string>",
"isPublished": false,
"auditType": "area",
"tags": [
"<string>"
],
"answeredStatusEnabled": true,
"questions": [
{
"categoryName": "<string>",
"questions": [
{
"question": "<string>",
"settings": {
"answer": [
"<string>"
],
"richOptions": [
{
"id": "<string>",
"text": "<string>",
"image": "<string>"
}
],
"ticketRequired": true,
"isAttachmentMandatory": true,
"attachments": [
"<string>"
],
"weightingfactor": 123,
"styling": {
"options": {}
}
},
"answer": [
"<unknown>"
],
"ticket": [
"<string>"
],
"description": "<string>"
}
],
"settings": {
"duplicate": true
}
}
],
"_attachments": {}
}
'import requests
url = "https://web.edcontrols.com/api/v2/data/audittemplates/{database}"
payload = {
"name": "<string>",
"groupId": "<string>",
"isPublished": False,
"auditType": "area",
"tags": ["<string>"],
"answeredStatusEnabled": True,
"questions": [
{
"categoryName": "<string>",
"questions": [
{
"question": "<string>",
"settings": {
"answer": ["<string>"],
"richOptions": [
{
"id": "<string>",
"text": "<string>",
"image": "<string>"
}
],
"ticketRequired": True,
"isAttachmentMandatory": True,
"attachments": ["<string>"],
"weightingfactor": 123,
"styling": { "options": {} }
},
"answer": ["<unknown>"],
"ticket": ["<string>"],
"description": "<string>"
}
],
"settings": { "duplicate": True }
}
],
"_attachments": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
groupId: '<string>',
isPublished: false,
auditType: 'area',
tags: ['<string>'],
answeredStatusEnabled: true,
questions: [
{
categoryName: '<string>',
questions: [
{
question: '<string>',
settings: {
answer: ['<string>'],
richOptions: [{id: '<string>', text: '<string>', image: '<string>'}],
ticketRequired: true,
isAttachmentMandatory: true,
attachments: ['<string>'],
weightingfactor: 123,
styling: {options: {}}
},
answer: ['<unknown>'],
ticket: ['<string>'],
description: '<string>'
}
],
settings: {duplicate: true}
}
],
_attachments: {}
})
};
fetch('https://web.edcontrols.com/api/v2/data/audittemplates/{database}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://web.edcontrols.com/api/v2/data/audittemplates/{database}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'groupId' => '<string>',
'isPublished' => false,
'auditType' => 'area',
'tags' => [
'<string>'
],
'answeredStatusEnabled' => true,
'questions' => [
[
'categoryName' => '<string>',
'questions' => [
[
'question' => '<string>',
'settings' => [
'answer' => [
'<string>'
],
'richOptions' => [
[
'id' => '<string>',
'text' => '<string>',
'image' => '<string>'
]
],
'ticketRequired' => true,
'isAttachmentMandatory' => true,
'attachments' => [
'<string>'
],
'weightingfactor' => 123,
'styling' => [
'options' => [
]
]
],
'answer' => [
'<unknown>'
],
'ticket' => [
'<string>'
],
'description' => '<string>'
]
],
'settings' => [
'duplicate' => true
]
]
],
'_attachments' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://web.edcontrols.com/api/v2/data/audittemplates/{database}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"groupId\": \"<string>\",\n \"isPublished\": false,\n \"auditType\": \"area\",\n \"tags\": [\n \"<string>\"\n ],\n \"answeredStatusEnabled\": true,\n \"questions\": [\n {\n \"categoryName\": \"<string>\",\n \"questions\": [\n {\n \"question\": \"<string>\",\n \"settings\": {\n \"answer\": [\n \"<string>\"\n ],\n \"richOptions\": [\n {\n \"id\": \"<string>\",\n \"text\": \"<string>\",\n \"image\": \"<string>\"\n }\n ],\n \"ticketRequired\": true,\n \"isAttachmentMandatory\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"weightingfactor\": 123,\n \"styling\": {\n \"options\": {}\n }\n },\n \"answer\": [\n \"<unknown>\"\n ],\n \"ticket\": [\n \"<string>\"\n ],\n \"description\": \"<string>\"\n }\n ],\n \"settings\": {\n \"duplicate\": true\n }\n }\n ],\n \"_attachments\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://web.edcontrols.com/api/v2/data/audittemplates/{database}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"groupId\": \"<string>\",\n \"isPublished\": false,\n \"auditType\": \"area\",\n \"tags\": [\n \"<string>\"\n ],\n \"answeredStatusEnabled\": true,\n \"questions\": [\n {\n \"categoryName\": \"<string>\",\n \"questions\": [\n {\n \"question\": \"<string>\",\n \"settings\": {\n \"answer\": [\n \"<string>\"\n ],\n \"richOptions\": [\n {\n \"id\": \"<string>\",\n \"text\": \"<string>\",\n \"image\": \"<string>\"\n }\n ],\n \"ticketRequired\": true,\n \"isAttachmentMandatory\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"weightingfactor\": 123,\n \"styling\": {\n \"options\": {}\n }\n },\n \"answer\": [\n \"<unknown>\"\n ],\n \"ticket\": [\n \"<string>\"\n ],\n \"description\": \"<string>\"\n }\n ],\n \"settings\": {\n \"duplicate\": true\n }\n }\n ],\n \"_attachments\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v2/data/audittemplates/{database}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"groupId\": \"<string>\",\n \"isPublished\": false,\n \"auditType\": \"area\",\n \"tags\": [\n \"<string>\"\n ],\n \"answeredStatusEnabled\": true,\n \"questions\": [\n {\n \"categoryName\": \"<string>\",\n \"questions\": [\n {\n \"question\": \"<string>\",\n \"settings\": {\n \"answer\": [\n \"<string>\"\n ],\n \"richOptions\": [\n {\n \"id\": \"<string>\",\n \"text\": \"<string>\",\n \"image\": \"<string>\"\n }\n ],\n \"ticketRequired\": true,\n \"isAttachmentMandatory\": true,\n \"attachments\": [\n \"<string>\"\n ],\n \"weightingfactor\": 123,\n \"styling\": {\n \"options\": {}\n }\n },\n \"answer\": [\n \"<unknown>\"\n ],\n \"ticket\": [\n \"<string>\"\n ],\n \"description\": \"<string>\"\n }\n ],\n \"settings\": {\n \"duplicate\": true\n }\n }\n ],\n \"_attachments\": {}\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"_rev": "<string>",
"name": "<string>",
"groupId": "<string>",
"group": "<string>",
"project": "<string>",
"isPublished": true,
"archived": "<string>",
"auditType": "<string>",
"answeredStatusEnabled": true,
"tags": [
"<string>"
],
"dates": {
"creationDate": "2023-11-07T05:31:56Z",
"lastModifiedDate": "2023-11-07T05:31:56Z"
},
"author": {
"email": "jsmith@example.com",
"type": "<string>"
},
"lastmodifier": {
"email": "jsmith@example.com",
"type": "<string>"
},
"versionInfo": {},
"_attachments": {},
"questions": [
{
"categoryName": "<string>",
"questions": [
{
"question": "<string>",
"settings": {
"answertype": "yesnona",
"choice": "single",
"answer": [
"<string>"
],
"richOptions": [
{
"id": "<string>",
"type": "textselect",
"text": "<string>",
"image": "<string>"
}
],
"ticketRequired": true,
"isAttachmentMandatory": true,
"attachments": [
"<string>"
],
"weightingfactor": 123,
"styling": {
"options": {}
}
},
"answer": [
"<unknown>"
],
"ticket": [
"<string>"
],
"description": "<string>"
}
],
"settings": {
"duplicate": true
}
}
]
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}Authorizations
Path Parameters
Body
The template group this template belongs to — the group document's
bare CouchDB id, not the composite {database}|{couchDbId} the group
list returns.
Mandatory, and it must name an existing, non-deleted template group in the same project. The Ed Controls editor refuses to save a template with no group, so a template created without one is readable here and impossible to edit in the app.
The question tree, exactly two levels deep: this array holds categories, and each category holds questions. There is no recursion, and a bare question at this level is rejected.
May be empty — a template with no questions is valid, and you can add
them with PATCH later.
Show child attributes
Show child attributes
CouchDB inline attachments, keyed by file name, each
{ "content_type": "...", "data": "<base64>" }.
This is where images used by questions live. Template images do not go through Filestack or the attachment service — the question refers to them by file name and the bytes sit on the document.
Response
The created audit template document.
