Create a catalog item.
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");curl_easy_setopt(hnd, CURLOPT_URL, "https://your-instance.seventhings.com/customer-api/v1/catalog-item");
struct curl_slist *headers = NULL;headers = curl_slist_append(headers, "Authorization: Bearer <token>");headers = curl_slist_append(headers, "Content-Type: application/json");curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{ \"fields\": { \"<field_key_1>\": \"<field_value_1>\", \"<field_key_2>\": \"<field_value_2>\", \"<field_key_3>\": \"<field_value_3>\" } }");
CURLcode ret = curl_easy_perform(hnd);using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://your-instance.seventhings.com/customer-api/v1/catalog-item"), Headers = { { "Authorization", "Bearer <token>" }, }, Content = new StringContent("{ \"fields\": { \"<field_key_1>\": \"<field_value_1>\", \"<field_key_2>\": \"<field_value_2>\", \"<field_key_3>\": \"<field_value_3>\" } }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}package main
import ( "fmt" "strings" "net/http" "io")
func main() {
url := "https://your-instance.seventhings.com/customer-api/v1/catalog-item"
payload := strings.NewReader("{ \"fields\": { \"<field_key_1>\": \"<field_value_1>\", \"<field_key_2>\": \"<field_value_2>\", \"<field_key_3>\": \"<field_value_3>\" } }")
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(res) fmt.Println(string(body))
}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://your-instance.seventhings.com/customer-api/v1/catalog-item")) .header("Authorization", "Bearer <token>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{ \"fields\": { \"<field_key_1>\": \"<field_value_1>\", \"<field_key_2>\": \"<field_value_2>\", \"<field_key_3>\": \"<field_value_3>\" } }")) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");RequestBody body = RequestBody.create(mediaType, "{ \"fields\": { \"<field_key_1>\": \"<field_value_1>\", \"<field_key_2>\": \"<field_value_2>\", \"<field_key_3>\": \"<field_value_3>\" } }");Request request = new Request.Builder() .url("https://your-instance.seventhings.com/customer-api/v1/catalog-item") .post(body) .addHeader("Authorization", "Bearer <token>") .addHeader("Content-Type", "application/json") .build();
Response response = client.newCall(request).execute();import axios from 'axios';
const options = { method: 'POST', url: 'https://your-instance.seventhings.com/customer-api/v1/catalog-item', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, data: { fields: { '<field_key_1>': '<field_value_1>', '<field_key_2>': '<field_value_2>', '<field_key_3>': '<field_value_3>' } }};
try { const { data } = await axios.request(options); console.log(data);} catch (error) { console.error(error);}const url = 'https://your-instance.seventhings.com/customer-api/v1/catalog-item';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"fields":{"<field_key_1>":"<field_value_1>","<field_key_2>":"<field_value_2>","<field_key_3>":"<field_value_3>"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")val body = RequestBody.create(mediaType, "{ \"fields\": { \"<field_key_1>\": \"<field_value_1>\", \"<field_key_2>\": \"<field_value_2>\", \"<field_key_3>\": \"<field_value_3>\" } }")val request = Request.Builder() .url("https://your-instance.seventhings.com/customer-api/v1/catalog-item") .post(body) .addHeader("Authorization", "Bearer <token>") .addHeader("Content-Type", "application/json") .build()
val response = client.newCall(request).execute()use serde_json::json;use reqwest;
#[tokio::main]pub async fn main() { let url = "https://your-instance.seventhings.com/customer-api/v1/catalog-item";
let payload = json!({"fields": json!({ "<field_key_1>": "<field_value_1>", "<field_key_2>": "<field_value_2>", "<field_key_3>": "<field_value_3>" })});
let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Authorization", "Bearer <token>".parse().unwrap()); headers.insert("Content-Type", "application/json".parse().unwrap());
let client = reqwest::Client::new(); let response = client.post(url) .headers(headers) .json(&payload) .send() .await;
let results = response.unwrap() .json::<serde_json::Value>() .await .unwrap();
dbg!(results);}curl --request POST \ --url https://your-instance.seventhings.com/customer-api/v1/catalog-item \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "fields": { "<field_key_1>": "<field_value_1>", "<field_key_2>": "<field_value_2>", "<field_key_3>": "<field_value_3>" } }'wget --quiet \ --method POST \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --body-data '{ "fields": { "<field_key_1>": "<field_value_1>", "<field_key_2>": "<field_value_2>", "<field_key_3>": "<field_value_3>" } }' \ --output-document \ - https://your-instance.seventhings.com/customer-api/v1/catalog-itemCreate an entry of the product catalog. Requires the product catalog feature and the right to create catalog items.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The field values of a catalog item, keyed like the fields of a read catalog item. A field
that is not part of the catalog is rejected, as is a value for a field that must stay empty
on a catalog item (e.g. a unique object field). Values for id, created_at, updated_at
and updated_by_user_id are ignored.
object
Fields defined in Template with its values, based on the type of the field. There is a difference with what can be send via POST/PUT/PATCH requests, and what will be returned via GET
This examples shows what data can be expected for ceraint field type:
POST/PUT/PATCH
{
"ATTACHMENT": "array<string (fileUuid)>",
"BARCODE": "string",
"DATE": "string (Y-m-d)",
"DATETIME": "string (Y-m-d\TH:i:sP)",
"DECIMAL": "decimal (1.23)",
"DROPDOWN": "string",
"LINK": "string",
"LINKED_ASSET": "int (asset id) | string (asset uuid)",
"LINKED_LOCATION": "int (location id) | string (location uuid)",
"LINKED_ROOM": "int (room id)| string (room uuid)",
"LINKED_USER": "int (user id)| string (user uuid)",
"LINKED_PERSON": "int (person id)| string (person uuid)",
"LONG_TEXT": "string",
"MONEY": "decimal (1.23)",
"NUMBER": "int (123)",
"REMINDER": "string (Y-m-d)",
"TEXT": "string",
}
GET
{
"ATTACHMENT": [
{
"uuid": "string (uuid)",
"type": "string",
"size": "int",
"data_uri": "string",
"file_uri": "string",
"thumbnail_uri": "string",
}
],
"BARCODE": "string",
"DATE": "string (Y-m-d)",
"DATETIME": "string (Y-m-d\TH:i:sP)",
"DECIMAL": "decimal (1.23)",
"DROPDOWN": "string",
"LINK": "string",
"LINKED_ASSET": {
"id": "int",
"uuid": "string (uuid)",
"display_name": "string"
},
"LINKED_LOCATION": {
"id": "int",
"uuid": "string (uuid)",
"display_name": "string"
},
"LINKED_ROOM": {
"id": "int",
"uuid": "string (uuid)",
"display_name": "string"
},
"LINKED_USER": {
"id": "int",
"uuid": "string (uuid)",
"display_name": "string"
},
"LINKED_PERSON": {
"id": "int",
"uuid": "string (uuid)",
"display_name": "string"
},
"LONG_TEXT": "string",
"MONEY": "decimal (1.23)",
"NUMBER": "int (123)",
"REMINDER": "string (Y-m-d)",
"TEXT": "string",
}
object
Example
{ "<field_key_1>": "<field_value_1>", "<field_key_2>": "<field_value_2>", "<field_key_3>": "<field_value_3>"}Responses
Section titled “Responses”Success
Headers
Section titled “Headers”The URL of the newly created catalog item.
The UUID of the newly created catalog item.
Request body is missing or invalid or request data is invalid.
Access token is missing or invalid.
You are not permitted to perform the requested operation.
The requested resource representation has no acceptable format.
Internal Server Error.

