Actualizar campos personalizados de un producto
curl --request PATCH \
--url https://api.lapyme.com.ar/api/v1/products/{product_id}/metafields \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entries": [
{
"key": "<string>",
"value": "<string>"
}
]
}
'import requests
url = "https://api.lapyme.com.ar/api/v1/products/{product_id}/metafields"
payload = { "entries": [
{
"key": "<string>",
"value": "<string>"
}
] }
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({entries: [{key: '<string>', value: '<string>'}]})
};
fetch('https://api.lapyme.com.ar/api/v1/products/{product_id}/metafields', 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.lapyme.com.ar/api/v1/products/{product_id}/metafields",
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([
'entries' => [
[
'key' => '<string>',
'value' => '<string>'
]
]
]),
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.lapyme.com.ar/api/v1/products/{product_id}/metafields"
payload := strings.NewReader("{\n \"entries\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\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.lapyme.com.ar/api/v1/products/{product_id}/metafields")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entries\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lapyme.com.ar/api/v1/products/{product_id}/metafields")
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 \"entries\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"data": {
"product": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"category": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"sku": "<string>",
"barcode": "<string>",
"currency": "<string>",
"cost": 123,
"price": 123,
"tax_rate": {
"id": 123,
"value": 123
},
"default_supplier": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"is_active": true,
"organization_slug": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"object": "<string>",
"variant_group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variant_options": {},
"is_exempt": true,
"metafields": [
{
"key": "<string>",
"value": "<string>"
}
],
"stock_summary": {
"total_quantity": 123,
"warehouse_count": 1,
"by_warehouse": [
{
"warehouse_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"warehouse_name": "<string>",
"quantity": 123,
"on_hand": 123,
"reserved_quantity": 123,
"incoming_quantity": 123
}
]
},
"effective_price": 123,
"applied_price_list": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"is_automatic": true,
"adjustment_percentage": 123,
"tax_inclusive": true
}
}
},
"warnings": [
"<unknown>"
]
}{
"request_id": "req_product_metafields_patch_1",
"error": {
"code": "INVALID_REQUEST",
"message": "Invalid product metafield request",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_metafields_patch_1",
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "Authentication required",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_metafields_patch_1",
"error": {
"code": "FORBIDDEN",
"message": "Product custom fields require Max or Enterprise",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_metafields_patch_1",
"error": {
"code": "NOT_FOUND",
"message": "Product not found",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_rate_limit_1",
"error": {
"type": "rate_limit_error",
"code": "RATE_LIMITED",
"message": "The organization request limit was reached. Try again later.",
"retryable": true,
"details": []
}
}{
"request_id": "req_product_metafields_patch_1",
"error": {
"code": "INTERNAL_ERROR",
"message": "Could not update product metafields",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}Actualizar campos personalizados de un producto
Actualiza solo las claves enviadas. Un string asigna el valor y null lo elimina. Los valores pertenecen al grupo y se comparten entre variantes. Requiere plan Max o Enterprise.
PATCH
/
api
/
v1
/
products
/
{product_id}
/
metafields
Actualizar campos personalizados de un producto
curl --request PATCH \
--url https://api.lapyme.com.ar/api/v1/products/{product_id}/metafields \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"entries": [
{
"key": "<string>",
"value": "<string>"
}
]
}
'import requests
url = "https://api.lapyme.com.ar/api/v1/products/{product_id}/metafields"
payload = { "entries": [
{
"key": "<string>",
"value": "<string>"
}
] }
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({entries: [{key: '<string>', value: '<string>'}]})
};
fetch('https://api.lapyme.com.ar/api/v1/products/{product_id}/metafields', 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.lapyme.com.ar/api/v1/products/{product_id}/metafields",
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([
'entries' => [
[
'key' => '<string>',
'value' => '<string>'
]
]
]),
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.lapyme.com.ar/api/v1/products/{product_id}/metafields"
payload := strings.NewReader("{\n \"entries\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\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.lapyme.com.ar/api/v1/products/{product_id}/metafields")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entries\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lapyme.com.ar/api/v1/products/{product_id}/metafields")
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 \"entries\": [\n {\n \"key\": \"<string>\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"request_id": "<string>",
"data": {
"product": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"category": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"sku": "<string>",
"barcode": "<string>",
"currency": "<string>",
"cost": 123,
"price": 123,
"tax_rate": {
"id": 123,
"value": 123
},
"default_supplier": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"is_active": true,
"organization_slug": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"object": "<string>",
"variant_group_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"variant_options": {},
"is_exempt": true,
"metafields": [
{
"key": "<string>",
"value": "<string>"
}
],
"stock_summary": {
"total_quantity": 123,
"warehouse_count": 1,
"by_warehouse": [
{
"warehouse_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"warehouse_name": "<string>",
"quantity": 123,
"on_hand": 123,
"reserved_quantity": 123,
"incoming_quantity": 123
}
]
},
"effective_price": 123,
"applied_price_list": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"is_automatic": true,
"adjustment_percentage": 123,
"tax_inclusive": true
}
}
},
"warnings": [
"<unknown>"
]
}{
"request_id": "req_product_metafields_patch_1",
"error": {
"code": "INVALID_REQUEST",
"message": "Invalid product metafield request",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_metafields_patch_1",
"error": {
"code": "AUTHENTICATION_REQUIRED",
"message": "Authentication required",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_metafields_patch_1",
"error": {
"code": "FORBIDDEN",
"message": "Product custom fields require Max or Enterprise",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_product_metafields_patch_1",
"error": {
"code": "NOT_FOUND",
"message": "Product not found",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}{
"request_id": "req_rate_limit_1",
"error": {
"type": "rate_limit_error",
"code": "RATE_LIMITED",
"message": "The organization request limit was reached. Try again later.",
"retryable": true,
"details": []
}
}{
"request_id": "req_product_metafields_patch_1",
"error": {
"code": "INTERNAL_ERROR",
"message": "Could not update product metafields",
"retryable": false,
"type": "invalid_request_error",
"details": []
}
}Authorizations
Incluí tu API key en el header Authorization con el prefijo Bearer.
Path Parameters
Body
application/json
Required array length:
1 - 100 elementsShow child attributes
Show child attributes
Was this page helpful?
⌘I

