curl --request POST \
--url https://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"project_file_id": 52135
}
'import requests
url = "https://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items"
payload = { "project_file_id": 52135 }
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({project_file_id: 52135})
};
fetch('https://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items', 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://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items",
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([
'project_file_id' => 52135
]),
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://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items"
payload := strings.NewReader("{\n \"project_file_id\": 52135\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://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"project_file_id\": 52135\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items")
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 \"project_file_id\": 52135\n}"
response = http.request(request)
puts response.read_body{
"id": 90211,
"tenant_id": 12,
"project_id": 9103,
"album_id": 6601,
"project_file_id": 52135,
"position": 2
}{
"message": "Unauthenticated."
}{
"message": "The requested resource could not be found."
}{
"message": "This project photo already belongs to this album.",
"errors": {
"project_file_id": [
"This project photo already belongs to this album."
]
}
}Create album item
Adds a photo to an album and returns the created item.
Request format
Album items don’t upload photos themselves — first upload the photo with Create project file, then attach it here by its id with project_file_id. The photo must belong to the same project and can’t already be in this album. Pass position to insert the item at a specific 1-based position, shifting later items back to make room; omit it to append the item to the end of the album.
Side effects
A note documenting the addition is added to the project’s activity feed, and the album’s total_photos updates automatically.
curl --request POST \
--url https://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"project_file_id": 52135
}
'import requests
url = "https://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items"
payload = { "project_file_id": 52135 }
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({project_file_id: 52135})
};
fetch('https://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items', 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://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items",
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([
'project_file_id' => 52135
]),
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://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items"
payload := strings.NewReader("{\n \"project_file_id\": 52135\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://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"project_file_id\": 52135\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.contractorscloud.com/api/v1/projects/{projectId}/albums/{albumId}/items")
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 \"project_file_id\": 52135\n}"
response = http.request(request)
puts response.read_body{
"id": 90211,
"tenant_id": 12,
"project_id": 9103,
"album_id": 6601,
"project_file_id": 52135,
"position": 2
}{
"message": "Unauthenticated."
}{
"message": "The requested resource could not be found."
}{
"message": "This project photo already belongs to this album.",
"errors": {
"project_file_id": [
"This project photo already belongs to this album."
]
}
}Authorizations
Path Parameters
Body
The id of the project photo to add to the album. Required. Must be a photo belonging to the same project, and must not already be placed in this album. Album items don't upload photos themselves — first upload the photo with Create project file, then attach it here by its id.
52130
The item's 1-based position within the album. Optional; when given, items already at or after this position shift back to make room. Must be between 1 and the current number of items in the album, plus one. When omitted, the item is appended to the end of the album.
x >= 1Response
The created album item.
The id of the project photo this item displays. See Project File.
52130