商品更新
curl --request PATCH \
--url https://api.utage-system.com/v1/products/{product_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"memo": "<string>",
"product_group_id": "<string>",
"business_id": "<string>",
"deny_multiple_purchases": true,
"has_sales_limit": true,
"max_sales_quantity": 1073741823,
"is_archived": true
}
'import requests
url = "https://api.utage-system.com/v1/products/{product_id}"
payload = {
"name": "<string>",
"memo": "<string>",
"product_group_id": "<string>",
"business_id": "<string>",
"deny_multiple_purchases": True,
"has_sales_limit": True,
"max_sales_quantity": 1073741823,
"is_archived": 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: '<string>',
memo: '<string>',
product_group_id: '<string>',
business_id: '<string>',
deny_multiple_purchases: true,
has_sales_limit: true,
max_sales_quantity: 1073741823,
is_archived: true
})
};
fetch('https://api.utage-system.com/v1/products/{product_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.utage-system.com/v1/products/{product_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>',
'memo' => '<string>',
'product_group_id' => '<string>',
'business_id' => '<string>',
'deny_multiple_purchases' => true,
'has_sales_limit' => true,
'max_sales_quantity' => 1073741823,
'is_archived' => 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.utage-system.com/v1/products/{product_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"memo\": \"<string>\",\n \"product_group_id\": \"<string>\",\n \"business_id\": \"<string>\",\n \"deny_multiple_purchases\": true,\n \"has_sales_limit\": true,\n \"max_sales_quantity\": 1073741823,\n \"is_archived\": 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.utage-system.com/v1/products/{product_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"memo\": \"<string>\",\n \"product_group_id\": \"<string>\",\n \"business_id\": \"<string>\",\n \"deny_multiple_purchases\": true,\n \"has_sales_limit\": true,\n \"max_sales_quantity\": 1073741823,\n \"is_archived\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.utage-system.com/v1/products/{product_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 \"memo\": \"<string>\",\n \"product_group_id\": \"<string>\",\n \"business_id\": \"<string>\",\n \"deny_multiple_purchases\": true,\n \"has_sales_limit\": true,\n \"max_sales_quantity\": 1073741823,\n \"is_archived\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"memo": "<string>",
"product_group_id": "<string>",
"business_id": "<string>",
"deny_multiple_purchases": true,
"has_sales_limit": true,
"max_sales_quantity": 123,
"is_archived": true,
"order": 123,
"created_at": "<string>",
"updated_at": "<string>"
}
}商品
商品更新
商品を更新します。指定したフィールドのみを更新する部分更新です。リクエストに含めなかったフィールドは既存の値が維持されます。
アーカイブ・アーカイブ解除は is_archived で行います(画面の「アーカイブ(非表示化)」「アーカイブを解除」と同じ)。アーカイブ済みの商品も取得・更新・削除はできます(一覧の表示分けと並び替えの対象外になるだけです)。表示順(order)はこのエンドポイントでは変更できません(商品並び替え PATCH /products/reorder を使用)。
product_group_id に null を指定すると未分類に、business_id に null を指定するとデフォルトに戻ります。name に null を指定できるのは既存の値が null の場合だけです。max_sales_quantity を省略すると既存の値(未設定なら 0)を維持します(has_sales_limit を true にするだけでは 422 になりません)。max_sales_quantity に null は指定できません(422)。
商品更新
curl --request PATCH \
--url https://api.utage-system.com/v1/products/{product_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"memo": "<string>",
"product_group_id": "<string>",
"business_id": "<string>",
"deny_multiple_purchases": true,
"has_sales_limit": true,
"max_sales_quantity": 1073741823,
"is_archived": true
}
'import requests
url = "https://api.utage-system.com/v1/products/{product_id}"
payload = {
"name": "<string>",
"memo": "<string>",
"product_group_id": "<string>",
"business_id": "<string>",
"deny_multiple_purchases": True,
"has_sales_limit": True,
"max_sales_quantity": 1073741823,
"is_archived": 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: '<string>',
memo: '<string>',
product_group_id: '<string>',
business_id: '<string>',
deny_multiple_purchases: true,
has_sales_limit: true,
max_sales_quantity: 1073741823,
is_archived: true
})
};
fetch('https://api.utage-system.com/v1/products/{product_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.utage-system.com/v1/products/{product_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>',
'memo' => '<string>',
'product_group_id' => '<string>',
'business_id' => '<string>',
'deny_multiple_purchases' => true,
'has_sales_limit' => true,
'max_sales_quantity' => 1073741823,
'is_archived' => 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.utage-system.com/v1/products/{product_id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"memo\": \"<string>\",\n \"product_group_id\": \"<string>\",\n \"business_id\": \"<string>\",\n \"deny_multiple_purchases\": true,\n \"has_sales_limit\": true,\n \"max_sales_quantity\": 1073741823,\n \"is_archived\": 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.utage-system.com/v1/products/{product_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"memo\": \"<string>\",\n \"product_group_id\": \"<string>\",\n \"business_id\": \"<string>\",\n \"deny_multiple_purchases\": true,\n \"has_sales_limit\": true,\n \"max_sales_quantity\": 1073741823,\n \"is_archived\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.utage-system.com/v1/products/{product_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 \"memo\": \"<string>\",\n \"product_group_id\": \"<string>\",\n \"business_id\": \"<string>\",\n \"deny_multiple_purchases\": true,\n \"has_sales_limit\": true,\n \"max_sales_quantity\": 1073741823,\n \"is_archived\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"memo": "<string>",
"product_group_id": "<string>",
"business_id": "<string>",
"deny_multiple_purchases": true,
"has_sales_limit": true,
"max_sales_quantity": 123,
"is_archived": true,
"order": 123,
"created_at": "<string>",
"updated_at": "<string>"
}
}PATCH
https://api.utage-system.com/v1/products/{product_id}
Body
application/json