curl --request POST \
--url https://web.edcontrols.com/api/v2/data/documents/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "file",
"sortby": "lastModifiedDate",
"sortOrder": "DESC",
"includeFields": [
"couchDbId",
"name",
"fileGroupId"
],
"aggregate": "fileGroupId"
}
'import requests
url = "https://web.edcontrols.com/api/v2/data/documents/search"
payload = {
"type": "file",
"sortby": "lastModifiedDate",
"sortOrder": "DESC",
"includeFields": ["couchDbId", "name", "fileGroupId"],
"aggregate": "fileGroupId"
}
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({
type: 'file',
sortby: 'lastModifiedDate',
sortOrder: 'DESC',
includeFields: ['couchDbId', 'name', 'fileGroupId'],
aggregate: 'fileGroupId'
})
};
fetch('https://web.edcontrols.com/api/v2/data/documents/search', 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/documents/search",
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([
'type' => 'file',
'sortby' => 'lastModifiedDate',
'sortOrder' => 'DESC',
'includeFields' => [
'couchDbId',
'name',
'fileGroupId'
],
'aggregate' => 'fileGroupId'
]),
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/documents/search"
payload := strings.NewReader("{\n \"type\": \"file\",\n \"sortby\": \"lastModifiedDate\",\n \"sortOrder\": \"DESC\",\n \"includeFields\": [\n \"couchDbId\",\n \"name\",\n \"fileGroupId\"\n ],\n \"aggregate\": \"fileGroupId\"\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/documents/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"file\",\n \"sortby\": \"lastModifiedDate\",\n \"sortOrder\": \"DESC\",\n \"includeFields\": [\n \"couchDbId\",\n \"name\",\n \"fileGroupId\"\n ],\n \"aggregate\": \"fileGroupId\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v2/data/documents/search")
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 \"type\": \"file\",\n \"sortby\": \"lastModifiedDate\",\n \"sortOrder\": \"DESC\",\n \"includeFields\": [\n \"couchDbId\",\n \"name\",\n \"fileGroupId\"\n ],\n \"aggregate\": \"fileGroupId\"\n}"
response = http.request(request)
puts response.read_body{
"size": 2,
"page": 0,
"hits": 5,
"results": [
{
"couchDbId": "7f3c2a9e5b1d4c8fa06e2b9d4c1a7e35",
"name": "Fire safety plan.pdf",
"fileGroupId": "2b8e4f1a9c6d4e3b8a7f5c0d1e2f3a4b"
},
{
"couchDbId": "c4d1e8a27b3f4a6e9d5c0b1a2f3e4d5c",
"name": "Inspection checklist.xlsx",
"fileGroupId": "2b8e4f1a9c6d4e3b8a7f5c0d1e2f3a4b"
}
],
"aggregations": {
"fileGroupId": [
{
"2b8e4f1a9c6d4e3b8a7f5c0d1e2f3a4b": 4
},
{
"9e8d7c6b5a4f4e3d8c2b1a0f9e8d7c6b": 1
}
]
}
}{
"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"
}Search the library (files and drawings together)
One list of a project’s library: its files and its drawings (maps)
together, as the Library screen of the web app shows them. Use it when
you want both kinds in one page, with one sort and one set of counts.
For one kind only, POST /file/search and POST /maps/search work the
same way.
database is a required query parameter, not a body field; page
and size are query parameters too. All body fields are optional, so
{} lists the whole active library, sorted by name.
type:fileormaplimits the list to one kind; leave it out for both.- A file that was turned into a drawing is listed once, as the drawing.
groupidfilters on the file group. Drawings have no file group, so withgroupidonly files come back.aggregatetakes a comma-separated list of fields, such asfileGroupIdortags, and adds a count per value toaggregations.includeFieldslimits each result to the fields you name, which keeps large libraries fast (for example["couchDbId", "name"]).sortbyisname(the default),creationDateorlastModifiedDate; sendsortOrder(ASCorDESC) with it.
Who sees what: a contract administrator, or an Accountable or Support
user of the project, gets the whole library. A Responsible user or a
Reporter gets only the drawings whose ids they send in mapIds;
without mapIds the answer is 200 with an empty body. Anyone else
gets 403.
To download a file from a result, use
GET /file/{database}/{id}/{versionId}/{fileName}/generateSignedLink.
curl --request POST \
--url https://web.edcontrols.com/api/v2/data/documents/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "file",
"sortby": "lastModifiedDate",
"sortOrder": "DESC",
"includeFields": [
"couchDbId",
"name",
"fileGroupId"
],
"aggregate": "fileGroupId"
}
'import requests
url = "https://web.edcontrols.com/api/v2/data/documents/search"
payload = {
"type": "file",
"sortby": "lastModifiedDate",
"sortOrder": "DESC",
"includeFields": ["couchDbId", "name", "fileGroupId"],
"aggregate": "fileGroupId"
}
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({
type: 'file',
sortby: 'lastModifiedDate',
sortOrder: 'DESC',
includeFields: ['couchDbId', 'name', 'fileGroupId'],
aggregate: 'fileGroupId'
})
};
fetch('https://web.edcontrols.com/api/v2/data/documents/search', 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/documents/search",
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([
'type' => 'file',
'sortby' => 'lastModifiedDate',
'sortOrder' => 'DESC',
'includeFields' => [
'couchDbId',
'name',
'fileGroupId'
],
'aggregate' => 'fileGroupId'
]),
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/documents/search"
payload := strings.NewReader("{\n \"type\": \"file\",\n \"sortby\": \"lastModifiedDate\",\n \"sortOrder\": \"DESC\",\n \"includeFields\": [\n \"couchDbId\",\n \"name\",\n \"fileGroupId\"\n ],\n \"aggregate\": \"fileGroupId\"\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/documents/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"file\",\n \"sortby\": \"lastModifiedDate\",\n \"sortOrder\": \"DESC\",\n \"includeFields\": [\n \"couchDbId\",\n \"name\",\n \"fileGroupId\"\n ],\n \"aggregate\": \"fileGroupId\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v2/data/documents/search")
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 \"type\": \"file\",\n \"sortby\": \"lastModifiedDate\",\n \"sortOrder\": \"DESC\",\n \"includeFields\": [\n \"couchDbId\",\n \"name\",\n \"fileGroupId\"\n ],\n \"aggregate\": \"fileGroupId\"\n}"
response = http.request(request)
puts response.read_body{
"size": 2,
"page": 0,
"hits": 5,
"results": [
{
"couchDbId": "7f3c2a9e5b1d4c8fa06e2b9d4c1a7e35",
"name": "Fire safety plan.pdf",
"fileGroupId": "2b8e4f1a9c6d4e3b8a7f5c0d1e2f3a4b"
},
{
"couchDbId": "c4d1e8a27b3f4a6e9d5c0b1a2f3e4d5c",
"name": "Inspection checklist.xlsx",
"fileGroupId": "2b8e4f1a9c6d4e3b8a7f5c0d1e2f3a4b"
}
],
"aggregations": {
"fileGroupId": [
{
"2b8e4f1a9c6d4e3b8a7f5c0d1e2f3a4b": 4
},
{
"9e8d7c6b5a4f4e3d8c2b1a0f9e8d7c6b": 1
}
]
}
}{
"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
Query Parameters
Body
Response
Search envelope. Each result is a file
(type IB.EdBundle.Document.File) or a drawing
(type IB.EdBundle.Document.Map), unless includeFields left
type out.
