Update a components record
curl --request PATCH \
--url https://api.autoprintfarm.com/public/v1/materials/components/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"name": "<string>",
"color": "<string>",
"brand": "<string>",
"diameter": "<string>",
"size": "<string>",
"remaining_units": 0,
"low_threshold": 1,
"location": "<string>"
}
'import requests
url = "https://api.autoprintfarm.com/public/v1/materials/components/{id}"
payload = {
"type": "<string>",
"name": "<string>",
"color": "<string>",
"brand": "<string>",
"diameter": "<string>",
"size": "<string>",
"remaining_units": 0,
"low_threshold": 1,
"location": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: '<string>',
name: '<string>',
color: '<string>',
brand: '<string>',
diameter: '<string>',
size: '<string>',
remaining_units: 0,
low_threshold: 1,
location: '<string>'
})
};
fetch('https://api.autoprintfarm.com/public/v1/materials/components/{id}', 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.autoprintfarm.com/public/v1/materials/components/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'name' => '<string>',
'color' => '<string>',
'brand' => '<string>',
'diameter' => '<string>',
'size' => '<string>',
'remaining_units' => 0,
'low_threshold' => 1,
'location' => '<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://api.autoprintfarm.com/public/v1/materials/components/{id}"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"brand\": \"<string>\",\n \"diameter\": \"<string>\",\n \"size\": \"<string>\",\n \"remaining_units\": 0,\n \"low_threshold\": 1,\n \"location\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.autoprintfarm.com/public/v1/materials/components/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"brand\": \"<string>\",\n \"diameter\": \"<string>\",\n \"size\": \"<string>\",\n \"remaining_units\": 0,\n \"low_threshold\": 1,\n \"location\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.autoprintfarm.com/public/v1/materials/components/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"brand\": \"<string>\",\n \"diameter\": \"<string>\",\n \"size\": \"<string>\",\n \"remaining_units\": 0,\n \"low_threshold\": 1,\n \"location\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"type": "<string>",
"name": "<string>",
"color": "<string>",
"brand": "<string>",
"diameter": "<string>",
"size": "<string>",
"remaining_units": 123,
"low_threshold": 123,
"status": "<string>",
"location": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": "<unknown>"
}
}Materials
Update a components record
Partial update — send only the fields you want to change. status is recomputed server-side. Cost/sourcing fields are never accepted.
PATCH
/
materials
/
components
/
{id}
Update a components record
curl --request PATCH \
--url https://api.autoprintfarm.com/public/v1/materials/components/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "<string>",
"name": "<string>",
"color": "<string>",
"brand": "<string>",
"diameter": "<string>",
"size": "<string>",
"remaining_units": 0,
"low_threshold": 1,
"location": "<string>"
}
'import requests
url = "https://api.autoprintfarm.com/public/v1/materials/components/{id}"
payload = {
"type": "<string>",
"name": "<string>",
"color": "<string>",
"brand": "<string>",
"diameter": "<string>",
"size": "<string>",
"remaining_units": 0,
"low_threshold": 1,
"location": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: '<string>',
name: '<string>',
color: '<string>',
brand: '<string>',
diameter: '<string>',
size: '<string>',
remaining_units: 0,
low_threshold: 1,
location: '<string>'
})
};
fetch('https://api.autoprintfarm.com/public/v1/materials/components/{id}', 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.autoprintfarm.com/public/v1/materials/components/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'type' => '<string>',
'name' => '<string>',
'color' => '<string>',
'brand' => '<string>',
'diameter' => '<string>',
'size' => '<string>',
'remaining_units' => 0,
'low_threshold' => 1,
'location' => '<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://api.autoprintfarm.com/public/v1/materials/components/{id}"
payload := strings.NewReader("{\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"brand\": \"<string>\",\n \"diameter\": \"<string>\",\n \"size\": \"<string>\",\n \"remaining_units\": 0,\n \"low_threshold\": 1,\n \"location\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.autoprintfarm.com/public/v1/materials/components/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"brand\": \"<string>\",\n \"diameter\": \"<string>\",\n \"size\": \"<string>\",\n \"remaining_units\": 0,\n \"low_threshold\": 1,\n \"location\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.autoprintfarm.com/public/v1/materials/components/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"<string>\",\n \"name\": \"<string>\",\n \"color\": \"<string>\",\n \"brand\": \"<string>\",\n \"diameter\": \"<string>\",\n \"size\": \"<string>\",\n \"remaining_units\": 0,\n \"low_threshold\": 1,\n \"location\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"type": "<string>",
"name": "<string>",
"color": "<string>",
"brand": "<string>",
"diameter": "<string>",
"size": "<string>",
"remaining_units": 123,
"low_threshold": 123,
"status": "<string>",
"location": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": "<unknown>"
}
}{
"success": false,
"error": {
"code": "NOT_FOUND",
"message": "Resource not found",
"details": "<unknown>"
}
}Authorizations
API keys are minted in the AutoPrintFarm web app under Settings → API Keys. Send as Authorization: Bearer apf_live_.... Keys are shown exactly once at creation and can be revoked at any time.
Path Parameters
Body
application/json
Required string length:
1 - 100Maximum string length:
200Maximum string length:
50Maximum string length:
100Maximum string length:
20Maximum string length:
50Required range:
x >= 0Required range:
x >= 0Maximum string length:
200Was this page helpful?
⌘I