SDK
import { createAdminClient } from "@voyant-travel/admin-client";
const client = createAdminClient({ baseUrl: "https://app.example.com", auth: { type: "apiKey", apiKey: process.env.VOYANT_ADMIN_TOKEN } });
const product = await client.products.update({ id: "<id>" }, {
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"productTypeId": "<string>",
"bookingMode": "<string>",
"capacityMode": "<string>",
"visibility": "<string>",
"sellCurrency": "<string>",
"sellAmountCents": 123,
"isFeatured": true
});curl --request PATCH \
--url https://app.example.com/v1/admin/products/<id> \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"productTypeId": "<string>",
"bookingMode": "<string>",
"capacityMode": "<string>",
"visibility": "<string>",
"sellCurrency": "<string>",
"sellAmountCents": 123,
"isFeatured": true
}'const response = await fetch("https://app.example.com/v1/admin/products/<id>", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <token>"
},
body: JSON.stringify({
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"productTypeId": "<string>",
"bookingMode": "<string>",
"capacityMode": "<string>",
"visibility": "<string>",
"sellCurrency": "<string>",
"sellAmountCents": 123,
"isFeatured": true
}),
});
const data = await response.json();import requests
response = requests.patch(
"https://app.example.com/v1/admin/products/<id>",
headers={
"Authorization": "Bearer <token>"
},
json={
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"productTypeId": "<string>",
"bookingMode": "<string>",
"capacityMode": "<string>",
"visibility": "<string>",
"sellCurrency": "<string>",
"sellAmountCents": 123,
"isFeatured": True
}
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{operatorDomain}/v1/admin/products/{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([
'name' => '<string>',
'slug' => '<string>',
'description' => '<string>',
'shortDescription' => '<string>',
'productTypeId' => '<string>',
'bookingMode' => '<string>',
'capacityMode' => '<string>',
'visibility' => '<string>',
'sellCurrency' => '<string>',
'sellAmountCents' => 123,
'isFeatured' => true
]),
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://{operatorDomain}/v1/admin/products/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"productTypeId\": \"<string>\",\n \"bookingMode\": \"<string>\",\n \"capacityMode\": \"<string>\",\n \"visibility\": \"<string>\",\n \"sellCurrency\": \"<string>\",\n \"sellAmountCents\": 123,\n \"isFeatured\": true\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://{operatorDomain}/v1/admin/products/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"productTypeId\": \"<string>\",\n \"bookingMode\": \"<string>\",\n \"capacityMode\": \"<string>\",\n \"visibility\": \"<string>\",\n \"sellCurrency\": \"<string>\",\n \"sellAmountCents\": 123,\n \"isFeatured\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{operatorDomain}/v1/admin/products/{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 \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"productTypeId\": \"<string>\",\n \"bookingMode\": \"<string>\",\n \"capacityMode\": \"<string>\",\n \"visibility\": \"<string>\",\n \"sellCurrency\": \"<string>\",\n \"sellAmountCents\": 123,\n \"isFeatured\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"description": "<string>",
"slug": "<string>",
"shortDescription": "<string>",
"bookingMode": "<string>",
"capacityMode": "<string>",
"visibility": "<string>",
"sellCurrency": "<string>",
"sellAmountCents": 123,
"startDate": "<string>",
"endDate": "<string>",
"pax": 123,
"isFeatured": true
}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}Products
Update a product
Patch fields on a product.
PATCH
/
v1
/
admin
/
products
/
{id}
SDK
import { createAdminClient } from "@voyant-travel/admin-client";
const client = createAdminClient({ baseUrl: "https://app.example.com", auth: { type: "apiKey", apiKey: process.env.VOYANT_ADMIN_TOKEN } });
const product = await client.products.update({ id: "<id>" }, {
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"productTypeId": "<string>",
"bookingMode": "<string>",
"capacityMode": "<string>",
"visibility": "<string>",
"sellCurrency": "<string>",
"sellAmountCents": 123,
"isFeatured": true
});curl --request PATCH \
--url https://app.example.com/v1/admin/products/<id> \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"productTypeId": "<string>",
"bookingMode": "<string>",
"capacityMode": "<string>",
"visibility": "<string>",
"sellCurrency": "<string>",
"sellAmountCents": 123,
"isFeatured": true
}'const response = await fetch("https://app.example.com/v1/admin/products/<id>", {
method: "PATCH",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <token>"
},
body: JSON.stringify({
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"productTypeId": "<string>",
"bookingMode": "<string>",
"capacityMode": "<string>",
"visibility": "<string>",
"sellCurrency": "<string>",
"sellAmountCents": 123,
"isFeatured": true
}),
});
const data = await response.json();import requests
response = requests.patch(
"https://app.example.com/v1/admin/products/<id>",
headers={
"Authorization": "Bearer <token>"
},
json={
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"shortDescription": "<string>",
"productTypeId": "<string>",
"bookingMode": "<string>",
"capacityMode": "<string>",
"visibility": "<string>",
"sellCurrency": "<string>",
"sellAmountCents": 123,
"isFeatured": True
}
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{operatorDomain}/v1/admin/products/{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([
'name' => '<string>',
'slug' => '<string>',
'description' => '<string>',
'shortDescription' => '<string>',
'productTypeId' => '<string>',
'bookingMode' => '<string>',
'capacityMode' => '<string>',
'visibility' => '<string>',
'sellCurrency' => '<string>',
'sellAmountCents' => 123,
'isFeatured' => true
]),
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://{operatorDomain}/v1/admin/products/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"productTypeId\": \"<string>\",\n \"bookingMode\": \"<string>\",\n \"capacityMode\": \"<string>\",\n \"visibility\": \"<string>\",\n \"sellCurrency\": \"<string>\",\n \"sellAmountCents\": 123,\n \"isFeatured\": true\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://{operatorDomain}/v1/admin/products/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"productTypeId\": \"<string>\",\n \"bookingMode\": \"<string>\",\n \"capacityMode\": \"<string>\",\n \"visibility\": \"<string>\",\n \"sellCurrency\": \"<string>\",\n \"sellAmountCents\": 123,\n \"isFeatured\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{operatorDomain}/v1/admin/products/{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 \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"description\": \"<string>\",\n \"shortDescription\": \"<string>\",\n \"productTypeId\": \"<string>\",\n \"bookingMode\": \"<string>\",\n \"capacityMode\": \"<string>\",\n \"visibility\": \"<string>\",\n \"sellCurrency\": \"<string>\",\n \"sellAmountCents\": 123,\n \"isFeatured\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"description": "<string>",
"slug": "<string>",
"shortDescription": "<string>",
"bookingMode": "<string>",
"capacityMode": "<string>",
"visibility": "<string>",
"sellCurrency": "<string>",
"sellAmountCents": 123,
"startDate": "<string>",
"endDate": "<string>",
"pax": 123,
"isFeatured": true
}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}Authorizations
Staff session or API token issued by your Voyant app.
Path Parameters
Body
application/json
Response
Updated product
Show child attributes
Show child attributes
⌘I