curl --request PUT \
--url https://web.edcontrols.com/api/v2/data/tickets/{database}/{ticketId}/uploadAttachment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'photo=@example-file;type=image/jpeg'import requests
url = "https://web.edcontrols.com/api/v2/data/tickets/{database}/{ticketId}/uploadAttachment"
files = { "photo": ("example-file", open("example-file", "rb"), "image/jpeg") }
headers = {"Authorization": "Bearer <token>"}
response = requests.put(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('photo', '<string>');
const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://web.edcontrols.com/api/v2/data/tickets/{database}/{ticketId}/uploadAttachment', 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/tickets/{database}/{ticketId}/uploadAttachment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"photo\"; filename=\"example-file\"\r\nContent-Type: image/jpeg\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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/tickets/{database}/{ticketId}/uploadAttachment"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"photo\"; filename=\"example-file\"\r\nContent-Type: image/jpeg\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://web.edcontrols.com/api/v2/data/tickets/{database}/{ticketId}/uploadAttachment")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"photo\"; filename=\"example-file\"\r\nContent-Type: image/jpeg\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v2/data/tickets/{database}/{ticketId}/uploadAttachment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"photo\"; filename=\"example-file\"\r\nContent-Type: image/jpeg\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"fileName": "crack.jpg",
"thumbnailFileName": "crack.256x192.jpg",
"contentType": "image/jpeg",
"length": 12345,
"comment": {
"note": "Re-inspected: the crack has not moved.",
"author": "inspector@example.com",
"time": "2026-09-09T13:04:12.652Z",
"public": true,
"attachments": [],
"allowedUsers": []
}
}{
"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"
}{
"timestamp": "2023-11-07T05:31:56Z",
"status": 415,
"error": "Unsupported Media Type",
"message": "<string>",
"path": "/api/v2/data/tickets/your_project_db/4785d213bb4d/uploadAttachment"
}{
"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"
}Attach a photo to a ticket
Attaches a photo to a ticket. multipart/form-data with a single part named
photo — the same part name and the same three content types as
PUT /api/v2/data/projects/{database}/{id}/uploadAttachment.
The photo is attached as a comment attachment, which is how it reaches the
Ed Controls apps: it appears in the ticket’s timeline and on the drawing pin’s
popover. A .256x192 thumbnail is generated for you and stored beside the
original; thumbnailFileName in the response names it.
The stored file name is not necessarily the one you sent. It is sanitised to a
single-dot, URL-safe name, given the extension the bytes require, and suffixed
(crack-1.jpg) when that name is already taken on the ticket. A PNG uploaded as
crack.jpg is stored as crack.png, and photo of crack (1).JPG becomes
photo-of-crack-1.jpg. Read fileName back from the response instead of
assuming — it is the only name the file can be fetched under.
The content type is decided by decoding the bytes, not from the part’s declared
Content-Type or the file name, which are both caller-supplied claims.
image/jpeg and image/png are accepted; anything else is 422 with a detail
naming what was actually found. The detail lists a third type, image/jpg, and
no upload is ever detected as one: the server shares its allowed-types list with
the project endpoint, and this is the list, not the outcome. A response’s
contentType is only ever image/jpeg or image/png.
Both files are then readable at
/api/v1/securedata/{database}/{ticketId}/{fileName}?access_token=....
Optimistic concurrency: the optional If-Match header behaves as it does on
PATCH (stale _rev → 409, nothing written).
Who may attach: anyone who may update the ticket, plus the ticket’s author while
the ticket is still created. Narrower than adding a comment, because an
attachment is a permanent binary on the document and this API cannot remove one.
Note the 415: a request that is not multipart at all is refused by the framework
before it reaches this endpoint, so — unlike every other error here — its body is
not application/problem+json. Error handling that reads detail has to
tolerate that one shape.
curl --request PUT \
--url https://web.edcontrols.com/api/v2/data/tickets/{database}/{ticketId}/uploadAttachment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'photo=@example-file;type=image/jpeg'import requests
url = "https://web.edcontrols.com/api/v2/data/tickets/{database}/{ticketId}/uploadAttachment"
files = { "photo": ("example-file", open("example-file", "rb"), "image/jpeg") }
headers = {"Authorization": "Bearer <token>"}
response = requests.put(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('photo', '<string>');
const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://web.edcontrols.com/api/v2/data/tickets/{database}/{ticketId}/uploadAttachment', 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/tickets/{database}/{ticketId}/uploadAttachment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"photo\"; filename=\"example-file\"\r\nContent-Type: image/jpeg\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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/tickets/{database}/{ticketId}/uploadAttachment"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"photo\"; filename=\"example-file\"\r\nContent-Type: image/jpeg\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://web.edcontrols.com/api/v2/data/tickets/{database}/{ticketId}/uploadAttachment")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"photo\"; filename=\"example-file\"\r\nContent-Type: image/jpeg\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://web.edcontrols.com/api/v2/data/tickets/{database}/{ticketId}/uploadAttachment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"photo\"; filename=\"example-file\"\r\nContent-Type: image/jpeg\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"fileName": "crack.jpg",
"thumbnailFileName": "crack.256x192.jpg",
"contentType": "image/jpeg",
"length": 12345,
"comment": {
"note": "Re-inspected: the crack has not moved.",
"author": "inspector@example.com",
"time": "2026-09-09T13:04:12.652Z",
"public": true,
"attachments": [],
"allowedUsers": []
}
}{
"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"
}{
"timestamp": "2023-11-07T05:31:56Z",
"status": 415,
"error": "Unsupported Media Type",
"message": "<string>",
"path": "/api/v2/data/tickets/your_project_db/4785d213bb4d/uploadAttachment"
}{
"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
Headers
Path Parameters
Body
Response
The stored file names, plus the comment the photo was attached to.
The result of PUT /tickets/{database}/{ticketId}/uploadAttachment. fileName is
authoritative — the stored name is derived from the bytes and from what is already
on the ticket, not from the name you sent.
