Metafields
Get Customer Metafields
GET https://api.bigcommerce.com/stores/{store_hash}/v3/customers/{customerId}/metafieldsRequest
Gets customer metafields by passing the
customerId
in the query parameters.Authentication
- X-Auth-Token in header
Parameters
- store_hash in path - string
- customerId in path - integerrequiredThe ID of the customer.
example
curl --request GET \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/customers/[customerId]/metafields' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'
Response
Response payload for the BigCommerce API.
Body
object | application/json
dataarray[object]
example
{
"data": [
{
"key": "Location",
"value": "4HG",
"namespace": "Warehouse Locations",
"permission_set": "app_only",
"description": "Location in the warehouse",
"resource_type": "customer",
"resource_id": 111
}
],
"meta": {
"pagination": {
"total": 36,
"count": 36,
"per_page": 50,
"current_page": 1,
"total_pages": 1,
"links": {
"previous": "string",
"current": "?page=1&limit=50",
"next": "string"
}
}
}
}
Create Customer Metafields
POST https://api.bigcommerce.com/stores/{store_hash}/v3/customers/{customerId}/metafieldsRequest
Creates Customer metafields by passing the
customerId
in the query parameters.Authentication
- X-Auth-Token in header
Parameters
- store_hash in path - string
- customerId in path - integerrequiredThe ID of the customer.
Body
object | application/json
Common Metafield properties.
namespacestring
required>= 1 characters<= 64 charactersNamespace for the metafield, for organizational purposes.
Example: Sales Departmentkeystring
required>= 1 characters<= 64 charactersThe name of the field, for example:
location_id
,color
.Example: Staff Namevaluestring
required>= 1 characters<= 65535 charactersThe value of the field, for example:
1
,blue
.Example: Ronaldodescriptionstring
>= 0 characters<= 255 charactersDescription for the metafields.
Example: Name of Staff Member
example
{
"permission_set": "app_only",
"namespace": "Sales Department",
"key": "Staff Name",
"value": "Ronaldo",
"description": "Name of Staff Member"
}
Response
Response payload for the BigCommerce API.
Body
object | application/json
Response payload for the BigCommerce API.
dataarray[object]
errorsarray[]
Empty for 200 responses.Example: []
example
{
"data": [
{
"permission_set": "app_only",
"namespace": "Sales Department",
"key": "Staff Name",
"value": "Ronaldo",
"description": "order",
"resource_type": "cart",
"id": 0,
"date_created": "2022-06-16T18:39:00+00:00",
"date_modified": "2022-06-16T18:39:00+00:00"
}
],
"errors": [],
"meta": {
"pagination": {
"total": 36,
"count": 36,
"per_page": 50,
"current_page": 1,
"total_pages": 1,
"links": {
"previous": "string",
"current": "?page=1&limit=50",
"next": "string"
}
}
}
Get a Customer Metafield
GET https://api.bigcommerce.com/stores/{store_hash}/v3/customers/{customerId}/metafields/{metafieldId}Request
Returns a single Customer Metafield.
Authentication
- X-Auth-Token in header
Parameters
- store_hash in path - string
- customerId in path - integerrequiredThe ID that belongs to the customer.
- metafieldId in path - integerrequiredThe ID that is generated for a metafield when created.
example
curl --request GET \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/customers/[customerId]/metafields/[metafieldId]' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'
Response
Body
object | application/json
dataobject
Metafield for products, categories, variants, and brands; the max number of metafields allowed on each is 50. For more information, see Platform Limits in the Help Center.
example
{
"data": {
"key": "Location",
"value": "4HG",
"namespace": "Warehouse Locations",
"permission_set": "app_only",
"description": "Location in the warehouse",
"resource_type": "customer",
"resource_id": 111
},
"meta": {}
}
Update a Metafield
PUT https://api.bigcommerce.com/stores/{store_hash}/v3/customers/{customerId}/metafields/{metafieldId}Request
Updates customer metafields. To update the customer metafields, use 'customerId' and 'metafield' in the query parameters.
Authentication
- X-Auth-Token in header
Parameters
- store_hash in path - string
- metafieldId in path - integerrequiredThe ID of the metafield belonging to the customer. The metafieldId is a generated response when sending a POST query to the Create a Customer Metafields endpoint.
- customerId in path - integerrequiredThe ID of the customer.
Body
object | application/json
Common Metafield properties.
namespacestring
>= 1 characters<= 64 charactersNamespace for the metafield, for organizational purposes.
Example: Sales Departmentkeystring
>= 1 characters<= 64 charactersThe name of the field, for example:
location_id
,color
.Example: Staff Namevaluestring
>= 1 characters<= 65535 charactersThe value of the field, for example:
1
,blue
.Example: Ronaldodescriptionstring
>= 0 characters<= 255 charactersDescription for the metafields.
Example: Name of Staff Memberidinteger
requiredThe ID of metafield to update.
Example: 42
example
{
"permission_set": "app_only",
"namespace": "Sales Department",
"key": "Staff Name",
"value": "Ronaldo",
"description": "Name of Staff Member",
"id": 42
}
Response
Response payload for the BigCommerce API.
Body
object | application/json
Response payload for the BigCommerce API.
dataarray[object]
errorsarray[]
Empty for 200 responses.Example: []
example
{
"data": [
{
"permission_set": "app_only",
"namespace": "Sales Department",
"key": "Staff Name",
"value": "Ronaldo",
"description": "order",
"resource_type": "cart",
"id": 0,
"date_created": "2022-06-16T18:39:00+00:00",
"date_modified": "2022-06-16T18:39:00+00:00"
}
],
"errors": [],
"meta": {
"pagination": {
"total": 36,
"count": 36,
"per_page": 50,
"current_page": 1,
"total_pages": 1,
"links": {
"previous": "string",
"current": "?page=1&limit=50",
"next": "string"
}
}
}
Delete a Customer Metafield
DELETE https://api.bigcommerce.com/stores/{store_hash}/v3/customers/{customerId}/metafields/{metafieldId}Request
Deletes a customer metafield. To delete a customer metafield, use 'customerId' and 'metafieldId' in the query parameters.
Authentication
- X-Auth-Token in header
Parameters
- store_hash in path - string
- customerId in path - integerrequiredThe ID of the customer.
- metafieldId in path - integerrequiredThe ID of the metafield belonging to the customer. The metafieldId is a generated response when sending a POST query to the Create a Customer Metafields endpoint.
example
curl --request DELETE \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/customers/[customerId]/metafields/[metafieldId]' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'
Response
Response object for customer metafields deletion with success.
Did you find what you were looking for?