Metafields Batch

Get All Customer Metafields

GET /customers/metafields

Request

Get all customer metafields.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string
  • page in query - integer

    Specifies the page number in a limited (paginated) list of products.

  • limit in query - integer

    Controls the number of items per page in a limited (paginated) list of products.

  • key in query - string
    Filter based on a metafieldʼs key.
  • key:in in query - array
    Filter based on comma-separated metafieldʼs keys. Could be used with vanilla 'key' query parameter.
    Type: array[string]
  • namespace in query - string
    Filter based on a metafieldʼs namespaces.
  • namespace:in in query - array
    Filter based on comma-separated metafieldʼs namespaces. Could be used with vanilla namespace query parameter.
    Type: array[string]
  • direction in query - string

    Sort direction. Acceptable values are: asc, desc.

    Allowed: asc | desc

  • include_fields in query - array
    Fields to include, in a comma-separated list. The ID and the specified fields will be returned.
    Type: array[string]

    Allowed: resource_id | key | value | namespace | permission_set | resource_type | description | owner_client_id | date_created | date_modified

  • date_modified:min in query - string
    Filter items by minimum date modified. For example, date_modified:min=2024-05-14T09:34:00ordate_modified:min=2019-09-04`. Returns metafields modified after this date.
  • date_modified:max in query - string
    Filter items by maximum date modified. For example, date_modified:max=2019-09-04T00:00:00 or date_modified:max=2019-09-04. Returns metafields modified before this date.
  • date_created:min in query - string
    Filter items by minimum date created. For example, date_created:min=2019-09-04T00:00:00 or date_created:min=2019-09-04. Returns metafields created after this date.
  • date_created:max in query - string
    Filter items by maximum date created. For example, date_created:max=2024-05-14T09:34:00ordate_created:max=2019-09-04`. Returns metafields created before this date.

example

curl --request GET \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/customers/metafields' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'

Response

List of Metafield objects.

Body

object | application/json

Response payload for the BigCommerce API.

  • data
    array[object]

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"
}
]
}

Create Multiple Metafields

POST /customers/metafields

Request

Create multiple metafields.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string

Body

array | application/json
  • permission_set
    string
    required

    Determines the visibility and writeability of the field by other API consumers.

    ValueDescription
    app_onlyPrivate to the app that owns the field.
    readVisible to other API consumers.
    writeOpen for reading and writing by other API consumers.
    read_and_sf_accessVisible to other API consumers, including on the storefront.
    write_and_sf_accessOpen for reading and writing by other API consumers, including on the storefront.

    Allowed: app_only | read | write | read_and_sf_access | write_and_sf_access

  • namespace
    string
    required

    Namespace for the metafield, for organizational purposes.

    >= 1 characters<= 64 characters
    Example: Sales Department
  • key
    string
    required

    The name of the field, for example: location_id, color.

    >= 1 characters<= 64 characters
    Example: Staff Name
  • value
    string
    required

    The value of the field, for example: 1, blue.

    >= 1 characters<= 65535 characters
    Example: Ronaldo
  • description
    string

    Description for the metafields.

    >= 0 characters<= 255 characters
    Example: Name of Staff Member
  • resource_id
    integer
    required

    The ID for the resource with which the metafield is associated.

    Example: 42

example

[
{
"permission_set": "app_only",
"namespace": "Sales Department",
"key": "Staff Name",
"value": "Ronaldo",
"description": "Name of Staff Member",
"resource_id": 42
}
]

Response

Response payload for the BigCommerce API.

Body

object | application/json
Response payload for the BigCommerce API.
  • data
    array[object]

  • errors
    array[]

    Empty for 200 responses.
    Example: []
  • meta
    object

    Data about the response, including pagination and collection totals.

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"
}
}
}

Update Multiple Metafields

PUT /customers/metafields

Request

Create multiple metafields.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string

Body

array | application/json
  • permission_set
    string

    Determines the visibility and writeability of the field by other API consumers.

    ValueDescription
    app_onlyPrivate to the app that owns the field.
    readVisible to other API consumers.
    writeOpen for reading and writing by other API consumers.
    read_and_sf_accessVisible to other API consumers, including on the storefront.
    write_and_sf_accessOpen for reading and writing by other API consumers, including on the storefront.

    Allowed: app_only | read | write | read_and_sf_access | write_and_sf_access

  • namespace
    string

    Namespace for the metafield, for organizational purposes.

    >= 1 characters<= 64 characters
    Example: Sales Department
  • key
    string

    The name of the field, for example: location_id, color.

    >= 1 characters<= 64 characters
    Example: Staff Name
  • value
    string

    The value of the field, for example: 1, blue.

    >= 1 characters<= 65535 characters
    Example: Ronaldo
  • description
    string

    Description for the metafields.

    >= 0 characters<= 255 characters
    Example: Name of Staff Member
  • id
    integer
    required

    The 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.
  • data
    array[object]

  • errors
    array[]

    Empty for 200 responses.
    Example: []
  • meta
    object

    Data about the response, including pagination and collection totals.

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 Multiple Metafields

DELETE /customers/metafields

Request

Delete all customer metafields.

Authentication

  • X-Auth-Token in header

Parameters

  • store_hash in path - string

example

curl --request DELETE \
--url 'https://api.bigcommerce.com/stores/[store_hash]/v3/customers/metafields' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Token: {{token}}'

Response

Response object for metafields deletion with success.

Body

object | application/json

Response payload for the BigCommerce API.

  • data
    array[integer]

    Type: array[integer]
    Example: [123,124,125]
  • errors
    array[]

    Empty for 200 responses.
    Example: []
  • meta
    object

    Additional data about the response.

example

{
"data": [
123,
124,
125
],
"errors": [],
"meta": {
"total": 3,
"success": 3,
"failed": 0
}
}
Did you find what you were looking for?