Get Metafields

GET /api/metafields.json

  • GET /api/metafields.json will return all Metafields. See the Filter Metafields endpoint for more info.

Example:

Status: 200 OK

[
  {
    "metafield": {
      "created_at": "2016-07-20T16:03:38+02:00",
      "description": "Some Metafield description",
      "id": 18,
      "key": "key",
      "metafieldable_id": 42,
      "metafieldable_type": "Product",
      "namespace": "namespace",
      "position": 1,
      "shop_id": 1,
      "updated_at": "2016-07-20T16:03:38+02:00",
      "value": "Some Value",
      "value_type": 0
    }
  }
]

Get Metafield

GET /api/metafields/18.json

  • GET /api/metafields/18.json will return the specified Metafield.

Example:

Status: 200 OK
{
  "metafield": {
    "created_at": "2016-07-20T16:03:38+02:00",
    "description": "Some Metafield description",
    "id": 18,
    "key": "key",
    "metafieldable_id": 42,
    "metafieldable_type": "Product",
    "namespace": "namespace",
    "position": 1,
    "shop_id": 1,
    "updated_at": "2016-07-20T16:03:38+02:00",
    "value": "Some Value",
    "value_type": 0
  }
}

Create Metafield

POST /api/metafields.json

  • POST /api/metafields.json will create a new Metafield from the parameters passed.

This will return 201 Created, with the location of the new Metafield in the Location header along with the current JSON representation of the Metafield if the creation was a success. See the Get Metafield endpoint for more info.

When trying to create a Metafield with an already existing metafieldabletype, metafieldableid, namespace and key combination, we will update the existing Metafield.


Update Metafield

PUT /api/metafields/18.json

  • PUT /api/metafields/18.json will update the Metafield from the parameters passed.

This will return  200 OKif the update was a success along with the current JSON representation of the Metafield. See the Get Metafield endpoint for more info.


Delete Metafield

DELETE /api/metafields/18.json

  • DELETE /api/metafields/18.json will delete the Metafield specified and return 200 OK if that was successful.

Get Metafield Count

GET /api/metafields/count.json

  • GET /api/metafields/count.json will return the Metafield count.

Filter Metafields

GET /api/metafields.json?filtername1=filtervalue1&filtername2=filtervalue2

  • GET /api/metafields.json?filtername1=filtervalue1&filtername2=filtervalue2 will return a filtered list of Metafields. See the [Get Metafields] endpoint for more information about the output.