Skip to main content

Create

GraphQL allows to query and mutate data. Mutations are operations like create, update and delete. This chapter describes how data can be created.

Simple create mutation

The area runtime allows access to entities fo the Runtime Model Let's start with simple sample that requests the name of all energy meters.

mutation {
runtime {
industryEnergyEnergyMeters {
create(
entities: [
{
voltage: 230
ampere: 0
power: 0
state: OFF
name: "Hello, World!"
}
]
) {
rtId
}
}
}
}

This query will create an energy meter object with the given data. The result of the object will be like

{
"data": {
"runtime": {
"industryEnergyEnergyMeters": {
"create": [
{
"rtId": "662532d5241639b42933057e"
}
]
}
}
}
}