DataObject Mutations
Data object mutations are used to create, update and delete data objects, documents, assets and translations.
Keep in mind that for all kinds of mutations you need the Write
permission and the mutation itself needs to be enabled in the configuration.
Please be aware, that not all operations are supported for all data types.
Note that for Create
and Update
operate you can query the updated data using the same request.
Supported Mutation Datatypes
Also check out the Pimcore's data type documentation.
For supported mutation datatypes please check the DataObjectMutationFieldConfigGenerator
folder in src/GraphQL/
.
Supported Mutation Operators
See operators section for more details.
Create Object
Request:
mutation {
createNews(parentId: 429, key: "news_created_by_gql", published: false) {
success
message
output(defaultLanguage: "de") {
id
creationDate
fullpath
title(language: "en")
}
}
}
Response:
{
"data": {
"createNews": {
"success": true,
"message": "object created: 1196",
"output": {
"id": "1196",
"creationDate": 1732785597,
"fullpath": "/Product Data/Accessories/lights/indicator lights/chevrolet-bel air-tail lights/news_created_by_gql",
"title": null
}
}
}
}
Update Object
Updates german title and short text and returns the modification date.
Request:
mutation {
updateNews(id: 1196, defaultLanguage: "de", input: {
title: "german TITLE",
shortText: "new short text"
}
) {
success
output {
modificationDate,
title
}
}
}
Response:
{
"data": {
"updateNews": {
"success": true,
"output": {
"modificationDate": 1732785648,
"title": "german TITLE"
}
}
}
}
Delete Object
Request:
mutation {
deleteNews(id: 1196) {
success
message
}
}
Response:
{
"data": {
"deleteNews": {
"success": true,
"message": ""
}
}
}
Extend Data Object Mutations
It is possible to add custom mutation data types and mutation operators. For details see detail documentation pages:
More Examples
See following list for more examples with data object mutations: