Skip to main content
PATCH
/
api
/
product-epc
/
{product_epc_hash}
/
state
Change Product EPC State
curl --request PATCH \
  --url https://app.buylo.ai/api/product-epc/{product_epc_hash}/state \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "status": "sold"
}
'
import requests

url = "https://app.buylo.ai/api/product-epc/{product_epc_hash}/state"

payload = { "status": "sold" }
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({status: 'sold'})
};

fetch('https://app.buylo.ai/api/product-epc/{product_epc_hash}/state', 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://app.buylo.ai/api/product-epc/{product_epc_hash}/state",
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([
'status' => 'sold'
]),
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://app.buylo.ai/api/product-epc/{product_epc_hash}/state"

payload := strings.NewReader("{\n \"status\": \"sold\"\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://app.buylo.ai/api/product-epc/{product_epc_hash}/state")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"sold\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app.buylo.ai/api/product-epc/{product_epc_hash}/state")

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 \"status\": \"sold\"\n}"

response = http.request(request)
puts response.read_body
{
  "message": "Product EPC state has been successfully updated",
  "updated_count": 3,
  "updated_hashes": [
    "8aaedfc3559d0ce545ca55bcea31aad2",
    "2b1c7f8c2aab4e33a5e09a2d77f3b611",
    "a7d9c4e8b3f2a1c5e7b9d4f8a2c6e9b1"
  ]
}
{
"message": "<string>"
}
{
"message": "<string>"
}
{
"message": "<string>"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

product_epc_hash
string
required

The hash of the product EPC to update

Body

application/json
status
enum<string>
required

The new status for the EPC

Available options:
registered,
stored,
transit,
in_store,
for_sale,
sold,
stolen,
cancelled,
reserved,
returned,
damaged
Example:

"sold"

Response

State updated successfully

message
string
required
Example:

"Product EPC state has been successfully updated"

updated_count
integer
required

Number of EPCs updated (includes grouped EPCs)

Example:

3

updated_hashes
string[]
required

List of all updated EPC hashes

Example:
[
"8aaedfc3559d0ce545ca55bcea31aad2",
"2b1c7f8c2aab4e33a5e09a2d77f3b611",
"a7d9c4e8b3f2a1c5e7b9d4f8a2c6e9b1"
]