Metafield Resource
Content
- Get Metafields
- Get Metafield
- Create Metafield
- Update Metafield
- Delete Metafield
- Get Metafield Count
- Filter Metafields
Get Metafields
- 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.
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 metafieldable_type, metafieldable_id, 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 OK if 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?filter_name1=filter_value1&filter_name2=filter_value2
- GET /api/metafields.json?filter_name_1=filter_value_1&filter_name_2=filter_value_2 will return a filtered list of Metafields. See the [Get Metafields] endpoint for more information about the output.