Patch item
curl --request PATCH \
--url https://api.neuronsearchlab.com/v1/items/{item_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Wireless Headphones v2",
"metadata": {
"category": "electronics",
"availability": "in_stock"
},
"active": true
}
'import requests
url = "https://api.neuronsearchlab.com/v1/items/{item_id}"
payload = {
"name": "Wireless Headphones v2",
"metadata": {
"category": "electronics",
"availability": "in_stock"
},
"active": True
}
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({
name: 'Wireless Headphones v2',
metadata: {category: 'electronics', availability: 'in_stock'},
active: true
})
};
fetch('https://api.neuronsearchlab.com/v1/items/{item_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.neuronsearchlab.com/v1/items/{item_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' => 'Wireless Headphones v2',
'metadata' => [
'category' => 'electronics',
'availability' => 'in_stock'
],
'active' => 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://api.neuronsearchlab.com/v1/items/{item_id}"
payload := strings.NewReader("{\n \"name\": \"Wireless Headphones v2\",\n \"metadata\": {\n \"category\": \"electronics\",\n \"availability\": \"in_stock\"\n },\n \"active\": 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://api.neuronsearchlab.com/v1/items/{item_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Wireless Headphones v2\",\n \"metadata\": {\n \"category\": \"electronics\",\n \"availability\": \"in_stock\"\n },\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neuronsearchlab.com/v1/items/{item_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\": \"Wireless Headphones v2\",\n \"metadata\": {\n \"category\": \"electronics\",\n \"availability\": \"in_stock\"\n },\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 3187,
"object": "item",
"name": "Wireless Headphones",
"description": "Noise-cancelling Bluetooth headphones.",
"metadata": {
"category": "electronics",
"brand": "Acme"
},
"active": true,
"created": 1777478400,
"updated_at": 1777478500
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "Validation error",
"details": {
"fieldErrors": {
"name": [
"Required"
]
}
}
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized_no_client_id_in_jwt",
"message": "Unauthorized: No client ID in JWT"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"type": "not_found_error",
"code": "item_not_found",
"message": "Item not found"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}Items
Patch item
Update an existing catalog item using the compatibility PATCH method.
PATCH
/
v1
/
items
/
{item_id}
Patch item
curl --request PATCH \
--url https://api.neuronsearchlab.com/v1/items/{item_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Wireless Headphones v2",
"metadata": {
"category": "electronics",
"availability": "in_stock"
},
"active": true
}
'import requests
url = "https://api.neuronsearchlab.com/v1/items/{item_id}"
payload = {
"name": "Wireless Headphones v2",
"metadata": {
"category": "electronics",
"availability": "in_stock"
},
"active": True
}
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({
name: 'Wireless Headphones v2',
metadata: {category: 'electronics', availability: 'in_stock'},
active: true
})
};
fetch('https://api.neuronsearchlab.com/v1/items/{item_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.neuronsearchlab.com/v1/items/{item_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' => 'Wireless Headphones v2',
'metadata' => [
'category' => 'electronics',
'availability' => 'in_stock'
],
'active' => 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://api.neuronsearchlab.com/v1/items/{item_id}"
payload := strings.NewReader("{\n \"name\": \"Wireless Headphones v2\",\n \"metadata\": {\n \"category\": \"electronics\",\n \"availability\": \"in_stock\"\n },\n \"active\": 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://api.neuronsearchlab.com/v1/items/{item_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Wireless Headphones v2\",\n \"metadata\": {\n \"category\": \"electronics\",\n \"availability\": \"in_stock\"\n },\n \"active\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.neuronsearchlab.com/v1/items/{item_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\": \"Wireless Headphones v2\",\n \"metadata\": {\n \"category\": \"electronics\",\n \"availability\": \"in_stock\"\n },\n \"active\": true\n}"
response = http.request(request)
puts response.read_body{
"id": 3187,
"object": "item",
"name": "Wireless Headphones",
"description": "Noise-cancelling Bluetooth headphones.",
"metadata": {
"category": "electronics",
"brand": "Acme"
},
"active": true,
"created": 1777478400,
"updated_at": 1777478500
}{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "Validation error",
"details": {
"fieldErrors": {
"name": [
"Required"
]
}
}
}
}{
"error": {
"type": "authentication_error",
"code": "unauthorized_no_client_id_in_jwt",
"message": "Unauthorized: No client ID in JWT"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"error": {
"type": "not_found_error",
"code": "item_not_found",
"message": "Item not found"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"details": "<unknown>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}This PATCH operation is an alternative item-update route. The SDK
patchItem helpers use POST Update item.
Use the NSL integer item ID and provide only fields you intend to change. For temporary unavailability, set active to false instead of deleting the item.Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
NSL-generated integer item ID.
Required range:
x >= 1Body
application/json
Partial item update. At least one field must be supplied.
Response
Updated item
Required range:
x >= 1Example:
3187
Available options:
item Example:
"Wireless Headphones"
Example:
"Noise-cancelling Bluetooth headphones."
Arbitrary JSON object used for filtering, ranking, and debugging.
Example:
{
"category": "electronics",
"brand": "Acme",
"price": 10999,
"currency": "usd"
}
Example:
true
Unix timestamp in seconds.
Example:
1777478400
Unix timestamp in seconds.
Example:
1777478500
Was this page helpful?

