Add or update listing metafields
const url = 'https://acme.mykreezalid.com/api/v1/listings/1/metafields';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"namespace":"erp","title":"warehouse_code","value":"WH-42"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://acme.mykreezalid.com/api/v1/listings/1/metafields \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "namespace": "erp", "title": "warehouse_code", "value": "WH-42" }'Attaches one metafield, or an array of metafields, to a listing. A metafield with the same namespace and title as an existing one replaces its value. You can also wrap the body in a metafield key. When you send one metafield the response key is metafield; when you send an array it is metafields. Both hold an array.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”ID of your listing
Request Bodyrequired
Section titled “Request Bodyrequired”A custom value you attach to a resource, identified by its namespace and title.
object
Group the metafield belongs to
Example
erpName of the metafield, unique within its namespace
Example
warehouse_codeValue of the metafield. Usually a string; it can be returned as a number or a JSON value depending on how the metafield was defined.
Example
WH-42A custom value you attach to a resource, identified by its namespace and title.
object
Group the metafield belongs to
Example
erpName of the metafield, unique within its namespace
Example
warehouse_codeValue of the metafield. Usually a string; it can be returned as a number or a JSON value depending on how the metafield was defined.
Example
WH-42Responses
Section titled “Responses”The saved metafields
object
When you sent one metafield
A custom value you attach to a resource, identified by its namespace and title.
object
Group the metafield belongs to
Name of the metafield, unique within its namespace
Value of the metafield. Usually a string; it can be returned as a number or a JSON value depending on how the metafield was defined.
When you sent an array
A custom value you attach to a resource, identified by its namespace and title.
object
Group the metafield belongs to
Name of the metafield, unique within its namespace
Value of the metafield. Usually a string; it can be returned as a number or a JSON value depending on how the metafield was defined.
Example
{ "metafield": [ { "namespace": "erp", "title": "warehouse_code", "value": "WH-42" } ], "metafields": [ { "namespace": "erp", "title": "warehouse_code", "value": "WH-42" } ]}Missing or wrong API credentials
No listing has this identifier
The body is not valid JSON, or a metafield misses namespace, title or value