curl --request POST \
--url https://web.edcontrols.com/api/v2/data/projects/{database}/audittemplates/{auditTemplateId}/createAudit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"responsible": "jsmith@example.com",
"tags": [
"<string>"
],
"dueDate": "2023-11-07T05:31:56Z",
"auditType": "<string>"
}
'import requests
url = "https://web.edcontrols.com/api/v2/data/projects/{database}/audittemplates/{auditTemplateId}/createAudit"
payload = {
"name": "<string>",
"responsible": "jsmith@example.com",
"tags": ["<string>"],
"dueDate": "2023-11-07T05:31:56Z",
"auditType": "<string>"
}
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>',
responsible: 'jsmith@example.com',
tags: ['<string>'],
dueDate: '2023-11-07T05:31:56Z',
auditType: '<string>'
})
};
fetch('https://web.edcontrols.com/api/v2/data/projects/{database}/audittemplates/{auditTemplateId}/createAudit', 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/projects/{database}/audittemplates/{auditTemplateId}/createAudit",
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>',
'responsible' => 'jsmith@example.com',
'tags' => [
'<string>'
],
'dueDate' => '2023-11-07T05:31:56Z',
'auditType' => '<string>'
]),
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/projects/{database}/audittemplates/{auditTemplateId}/createAudit"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"responsible\": \"jsmith@example.com\",\n \"tags\": [\n \"<string>\"\n ],\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"auditType\": \"<string>\"\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/projects/{database}/audittemplates/{auditTemplateId}/createAudit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"responsible\": \"jsmith@example.com\",\n \"tags\": [\n \"<string>\"\n ],\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"auditType\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v2/data/projects/{database}/audittemplates/{auditTemplateId}/createAudit")
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 \"responsible\": \"jsmith@example.com\",\n \"tags\": [\n \"<string>\"\n ],\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"auditType\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"id": "<string>",
"rev": "2-9a1c…"
}{
"message": "User not authorized for this audit",
"code": "FORBIDDEN",
"status": "403"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}{
"message": "User not authorized for this audit",
"code": "FORBIDDEN",
"status": "403"
}{
"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 from a template
Creating an audit requires copying and resetting template-specific
fields, so it is exposed as a dedicated operation rather than a plain
document POST. The new audit starts in status In Progress, and the
template’s photos are copied onto it.
The body is optional and every field in it is optional. A value that
does not pass its check is dropped without an error, and the audit
is created without it: a name over 500 characters, a responsible
that is not an e-mail address, a dueDate that is not a future
ISO 8601 date-time. Read the audit back if you need to be sure.
Any template that is not archived or deleted can be used, published or
not. An archived or deleted template is refused with 400.
Allowed for contract administrators, Accountable and Support.
curl --request POST \
--url https://web.edcontrols.com/api/v2/data/projects/{database}/audittemplates/{auditTemplateId}/createAudit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"responsible": "jsmith@example.com",
"tags": [
"<string>"
],
"dueDate": "2023-11-07T05:31:56Z",
"auditType": "<string>"
}
'import requests
url = "https://web.edcontrols.com/api/v2/data/projects/{database}/audittemplates/{auditTemplateId}/createAudit"
payload = {
"name": "<string>",
"responsible": "jsmith@example.com",
"tags": ["<string>"],
"dueDate": "2023-11-07T05:31:56Z",
"auditType": "<string>"
}
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>',
responsible: 'jsmith@example.com',
tags: ['<string>'],
dueDate: '2023-11-07T05:31:56Z',
auditType: '<string>'
})
};
fetch('https://web.edcontrols.com/api/v2/data/projects/{database}/audittemplates/{auditTemplateId}/createAudit', 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/projects/{database}/audittemplates/{auditTemplateId}/createAudit",
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>',
'responsible' => 'jsmith@example.com',
'tags' => [
'<string>'
],
'dueDate' => '2023-11-07T05:31:56Z',
'auditType' => '<string>'
]),
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/projects/{database}/audittemplates/{auditTemplateId}/createAudit"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"responsible\": \"jsmith@example.com\",\n \"tags\": [\n \"<string>\"\n ],\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"auditType\": \"<string>\"\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/projects/{database}/audittemplates/{auditTemplateId}/createAudit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"responsible\": \"jsmith@example.com\",\n \"tags\": [\n \"<string>\"\n ],\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"auditType\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v2/data/projects/{database}/audittemplates/{auditTemplateId}/createAudit")
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 \"responsible\": \"jsmith@example.com\",\n \"tags\": [\n \"<string>\"\n ],\n \"dueDate\": \"2023-11-07T05:31:56Z\",\n \"auditType\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"id": "<string>",
"rev": "2-9a1c…"
}{
"message": "User not authorized for this audit",
"code": "FORBIDDEN",
"status": "403"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}{
"message": "User not authorized for this audit",
"code": "FORBIDDEN",
"status": "403"
}{
"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"
}