Update a metaobject entry
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/metaobjects/example/entries/example';const options = { method: 'PATCH', headers: {'x-api-key': '<x-api-key>', 'Content-Type': 'application/json'}, body: '{"handle":"example","status":"active","fields":{}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://apibase.ecomweb.app/api/v1/stores/example/metaobjects/example/entries/example \ --header 'Content-Type: application/json' \ --header 'x-api-key: <x-api-key>' \ --data '{ "handle": "example", "status": "active", "fields": {} }'Changes an entry’s handle, status or field values. Values in fields merge into the stored ones per key, and null clears a field; keys you leave out stay as they are. The merged entry is validated against the definition.
Required scopes: write:metaobjects
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The metaobject definition’s type handle.
The entry ID.
The store’s ref, as returned by GET /stores.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The entry’s handle, 1 to 255 lowercase letters, digits or hyphens. Generated from the display name when left out on create.
Active or draft. Only used when the definition has a status; otherwise every entry is active. Defaults to active on create.
Field values, keyed by field key. On update, values merge per key and null clears a field; on create, required fields must be present.
object
Responses
Section titled “Responses”object
Entry ID, as a string.
ID of the metaobject definition the entry belongs to.
Active or draft. Always active when the definition has no status.
The field values, keyed by field key. Fields without a value are left out.
object
ID of the user who created the entry, or null.
ID of the user who last updated the entry, or null.
When the entry was created, as an ISO 8601 timestamp.
When the entry was last updated, as an ISO 8601 timestamp.
The entry’s handle, unique within its type. Generated from the display name when not given on create.
The text that names the entry: the display-name field’s value, or the handle.
The type handle of the entry’s definition.
Example
{ "status": "active"}The request is malformed or failed validation.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The resource does not exist in this store.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The request conflicts with the resource’s current state.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}