Object Metafields
The following endpoints allow you to get, add, edit and delete Metafields in your Object.
Quick Tip
Your read
and write
keys will be required to perform the following
requests. These can be found in Your Bucket > Settings > API Access in
your Bucket Dashboard .
Get Object Metafields
Get Metafields in your Object.
Parameter | Required | Type | Description |
---|---|---|---|
read_key | required | String | Restrict read access to your Bucket |
pretty | Enum | true, Makes the response more reader-friendly |
Definition
GET $BASE_URL/buckets/${bucket_slug}/objects/${object_id}/metafields
Example Response
{"metafields": [{"children": null,"type": "number","title": "number","key": "number","id": "Hvix3sGVi0","value": ""},{"children": null,"type": "radio-buttons","title": "radio-buttons","key": "radio-buttons","id": "QCEI7BnfuO","value": "Ok","options": [{"value": "Ok"},{"value": "All"}]}],"total": 2}
Get Object Metafield
Returns a single Metafield by key
from your Object.
Parameter | Required | Type | Description |
---|---|---|---|
read_key | required | String | Restrict read access to your Bucket |
pretty | Enum | true, Makes the response more reader-friendly |
Definition
GET $BASE_URL/buckets/${bucket_slug}/objects/${object_id}/metafields/${metafield_key}
Example Response
{"metafield": {"children": null,"type": "radio-buttons","title": "radio-buttons","key": "radio-buttons","id": "QCEI7BnfuO","value": "Ok","options": [{"value": "Ok"},{"value": "All"}]}}
Add Object Metafield
Add a new Metafield to your Object.
Required
write_key
must be passed as Authorization Bearer
in the header of the
request.
Take a look at Metafield Model for reference to be passed in the body.
Definition
POST $BASE_URL/buckets/${bucket_slug}/objects/${object_id}/metafields
Header
{"Authorization": "Bearer n5MbD59UPBoVpyqi6B6DnOzAvZ..."}
Example Body (JSON)
{"type": "number","title": "Example Phone number","key": "example-phone-number","value": 123456789}
Example Response
{"message": "metafield with key: 'example-phone-number' added successfully in object with id:'${object_id}"}
Edit Object Metafield
Edit an existing Metafield by key
in your Object.
Required
write_key
must be passed as Authorization Bearer
in the header of the
request.
Take a look at Metafield Model for reference to be passed in the body.
Note: At least one of the Parameters is required to process the request.
Definition
PATCH $BASE_URL/buckets/${bucket_slug}/objects/${object_id}/metafields/${metafield_key}
Header
{"Authorization": "Bearer n5MbD59UPBoVpyqi6B6DnOzAvZ..."}
Example Body (JSON)
{"value": 9876543210}
Example Response
{"metafield": {"type": "number","title": "Example Phone number","key": "phone_number","value": 9876543210}}
Delete Object Metafield
Delete an existing Metafield by key
from your Object.
Required
write_key
must be passed as Authorization Bearer
in the header of the
request.
Definition
DELETE $BASE_URL/buckets/${bucket_slug}/objects/${object_id}/metafields/${metafield_key}
Header
{"Authorization": "Bearer n5MbD59UPBoVpyqi6B6DnOzAvZ..."}
Example Response
{"message": "metafield with key: '${metafield_key}' deleted successfully from object with id:'${object_id}"}