curl --request POST \
--url https://web.edcontrols.com/api/v2/data/audits/templategroups/{database} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Handover checks"
}
'import requests
url = "https://web.edcontrols.com/api/v2/data/audits/templategroups/{database}"
payload = { "name": "Handover checks" }
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: 'Handover checks'})
};
fetch('https://web.edcontrols.com/api/v2/data/audits/templategroups/{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/audits/templategroups/{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' => 'Handover checks'
]),
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/audits/templategroups/{database}"
payload := strings.NewReader("{\n \"name\": \"Handover checks\"\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/audits/templategroups/{database}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Handover checks\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v2/data/audits/templategroups/{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\": \"Handover checks\"\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"couchDbId": "<string>",
"_rev": "<string>",
"name": "<string>",
"project": "<string>",
"archived": "<string>",
"content": {
"author": "<string>",
"lastmodifier": "<string>"
},
"dates": {
"creationDate": "2023-11-07T05:31:56Z",
"lastModifiedDate": "2023-11-07T05:31:56Z"
}
}{
"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"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}Create a template group
Creates a template group in a project.
Every audit template must belong to a group, so this is the first call
to make in a project that has none — without it the mandatory groupId
on Create an audit template cannot be
satisfied.
Only name is required. The server sets type, project, content
(author and lastmodifier, from the token’s user), dates, timeline
and archived, and ignores those fields if you send them.
_id and couchDbId in the response hold the same value, so either
works as a template’s groupId. The group is usable immediately —
it takes a few seconds to appear in GET /api/v2/data/audits/templategroups, which reads a search index, but a
template can point at it straight away.
A duplicate name is refused with 409. The name is compared whole,
so “Handover” does not collide with “Handover checks”, and after
trimming. A name freed by deleting a group can be reused.
The check reads the same search index the group list reads, which lags a write by a few seconds — so two creates of the same name fired back-to-back can both succeed. De-duplicate your own input if you are importing groups in bulk.
There is no rename endpoint. A group’s name is copied onto every template in it, so a rename has to update all of them; the Ed Controls app does that, and the API does not offer a half-version of it.
Requires the service account to be Accountable or Support on the project, or a contract admin.
Two URL shapes. Also answers on
POST /api/v2/data/projects/{database}/audits/templategroups, the
canonical project-scoped shape. One handler, both paths, both supported
indefinitely.
curl --request POST \
--url https://web.edcontrols.com/api/v2/data/audits/templategroups/{database} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Handover checks"
}
'import requests
url = "https://web.edcontrols.com/api/v2/data/audits/templategroups/{database}"
payload = { "name": "Handover checks" }
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: 'Handover checks'})
};
fetch('https://web.edcontrols.com/api/v2/data/audits/templategroups/{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/audits/templategroups/{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' => 'Handover checks'
]),
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/audits/templategroups/{database}"
payload := strings.NewReader("{\n \"name\": \"Handover checks\"\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/audits/templategroups/{database}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Handover checks\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v2/data/audits/templategroups/{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\": \"Handover checks\"\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"couchDbId": "<string>",
"_rev": "<string>",
"name": "<string>",
"project": "<string>",
"archived": "<string>",
"content": {
"author": "<string>",
"lastmodifier": "<string>"
},
"dates": {
"creationDate": "2023-11-07T05:31:56Z",
"lastModifiedDate": "2023-11-07T05:31:56Z"
}
}{
"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"
}{
"type": "about:blank",
"title": "Unprocessable Entity",
"status": 422,
"detail": "content.title is required"
}Authorizations
Path Parameters
Body
Response
The created template group.
A named folder for audit templates, within one project.
