Updating Entities
The Gateway provides an endpoint to update entities in the database.
We provide two methods to update entities: patch and put.
The patch method is used to update specific fields of an entity, while the put method is used to replace the entire entity.
If you want to update channels, pools or remoteIdentifiers, have a look at.
Request
The structure of the request body is the same for both methods.
Entity (entity)
The entity object contains the updated entity.
Options (options)
"selfCorrect": boolean (default: false)
If set to true, the Gateway will try to correct the entity if it is not valid.
"setInitValue": boolean (default: false)
If set to true, the Gateway will set the initial value for all properties that are not set.
"ignoreUnknownFields": boolean (default: false)
If set to true, the Gateway will ignore unknown fields in the entity. Otherwise, the Gateway will return an error if unknown fields are present.
PATCH
As described above, the patch method is used to update specific fields of an entity.
Request
We use the example entities as a starting point here.
PATCH/api/v1/entities/:id
{
"entity": {
"_id": "6798b7b709256629566d21bd",
"content": {
"schema:description": [
{
"value": "Gamescom (proper spelling: gamescom) is the world's largest trade fair for computer and video games and consumer electronics, which takes place annually in Cologne. Manufacturers from all over the world present their new software and hardware at the trade fair.\n\nGamescom has been held at the Koelnmesse exhibition center since 2009. Previously, it had already existed from 2002 to 2008 under the name Games Convention in Leipzig. Since 2018, the trade fair has been organized by the German Games Industry Association - game.",
"lang": "en"
},
{
"value": "Die Gamescom (Eigenschreibweise: gamescom) ist die weltweit größte Messe für Computer- und Videospiele sowie Unterhaltungselektronik, welche jährlich in Köln stattfindet. Hersteller aus aller Welt präsentieren auf der Messe ihre neue Soft- und Hardware.\n\nSeit dem Jahr 2009 findet die Gamescom auf dem Gelände der Koelnmesse statt. Zuvor existierte sie bereits von 2002 bis 2008 unter dem Namen Games Convention in Leipzig. Träger der Messe ist seit 2018 der Verband der deutschen Games-Branche – game.",
"lang": "de-DE"
}
]
}
},
// Not required, see below for more information
"options": {}
}
Response
We see here that the schema:description field has been updated.
{
"status": "success",
"entity": {
"_id": "6798b7b709256629566d21bd",
"types": [
"schema:Event"
],
"project": "66f3d1e6382ece6f7570ff3c",
"content": {
"schema:name": [
{
"value": "Gamescom 2077",
"lang": "en"
}
],
"venus:shortDescription": [
{
"value": "The biggest gaming event in the world.",
"lang": "en"
},
{
"value": "Die größte Gaming-Veranstaltung der Welt.",
"lang": "de-DE"
}
],
"schema:description": [
{
"value": "Gamescom (proper spelling: gamescom) is the world's largest trade fair for computer and video games and consumer electronics, which takes place annually in Cologne. Manufacturers from all over the world present their new software and hardware at the trade fair.\n\nGamescom has been held at the Koelnmesse exhibition center since 2009. Previously, it had already existed from 2002 to 2008 under the name Games Convention in Leipzig. Since 2018, the trade fair has been organized by the German Games Industry Association - game.",
"lang": "en"
},
{
"value": "Die Gamescom (Eigenschreibweise: gamescom) ist die weltweit größte Messe für Computer- und Videospiele sowie Unterhaltungselektronik, welche jährlich in Köln stattfindet. Hersteller aus aller Welt präsentieren auf der Messe ihre neue Soft- und Hardware.\n\nSeit dem Jahr 2009 findet die Gamescom auf dem Gelände der Koelnmesse statt. Zuvor existierte sie bereits von 2002 bis 2008 unter dem Namen Games Convention in Leipzig. Träger der Messe ist seit 2018 der Verband der deutschen Games-Branche – game.",
"lang": "de-DE"
}
],
"schema:startDate": "2077-08-17T00:00:00.000Z",
"schema:endDate": "2077-08-21T23:59:59.000Z",
"venus:address": {
"street": "Messeplatz 1",
"postalCode": "50679",
"city": "Cologne",
"country": "Germany"
}
}
},
"protocol": {}
}
The response structure is the same as for the create entity endpoint.
PUT
As described above, the put method is used to replace the entire entity.
Since the PUT overrides the entire entity, you need to provide at least all required properties of the entity.
The project and _id are not overridable!
Request
NOTE: We use the example entities as a starting point here.
PUT/api/v1/entities/:id
{
"entity": {
"_id": "6798b7b709256629566d21bd",
"content": {
"types": [
"schema:Event"
],
"schema:name": [
{
"value": "Gamescom 2077",
"lang": "en"
}
],
"schema:description": [
{
"value": "Gamescom (proper spelling: gamescom) is the world's largest trade fair for computer and video games and consumer electronics, which takes place annually in Cologne. Manufacturers from all over the world present their new software and hardware at the trade fair.\n\nGamescom has been held at the Koelnmesse exhibition center since 2009. Previously, it had already existed from 2002 to 2008 under the name Games Convention in Leipzig. Since 2018, the trade fair has been organized by the German Games Industry Association - game.",
"lang": "en"
},
{
"value": "Die Gamescom (Eigenschreibweise: gamescom) ist die weltweit größte Messe für Computer- und Videospiele sowie Unterhaltungselektronik, welche jährlich in Köln stattfindet. Hersteller aus aller Welt präsentieren auf der Messe ihre neue Soft- und Hardware.\n\nSeit dem Jahr 2009 findet die Gamescom auf dem Gelände der Koelnmesse statt. Zuvor existierte sie bereits von 2002 bis 2008 unter dem Namen Games Convention in Leipzig. Träger der Messe ist seit 2018 der Verband der deutschen Games-Branche – game.",
"lang": "de-DE"
}
]
}
},
// Not required, see below for more information
"options": {}
}
Response
We see here that the entitiy was replaced with the payload we sent earlier.
{
"status": "success",
"entity": {
"_id": "6798b7b709256629566d21bd",
"types": [
"schema:Event"
],
"project": "66f3d1e6382ece6f7570ff3c",
"content": {
"schema:name": [
{
"value": "Gamescom 2077",
"lang": "en"
}
],
"schema:description": [
{
"value": "Gamescom (proper spelling: gamescom) is the world's largest trade fair for computer and video games and consumer electronics, which takes place annually in Cologne. Manufacturers from all over the world present their new software and hardware at the trade fair.\n\nGamescom has been held at the Koelnmesse exhibition center since 2009. Previously, it had already existed from 2002 to 2008 under the name Games Convention in Leipzig. Since 2018, the trade fair has been organized by the German Games Industry Association - game.",
"lang": "en"
},
{
"value": "Die Gamescom (Eigenschreibweise: gamescom) ist die weltweit größte Messe für Computer- und Videospiele sowie Unterhaltungselektronik, welche jährlich in Köln stattfindet. Hersteller aus aller Welt präsentieren auf der Messe ihre neue Soft- und Hardware.\n\nSeit dem Jahr 2009 findet die Gamescom auf dem Gelände der Koelnmesse statt. Zuvor existierte sie bereits von 2002 bis 2008 unter dem Namen Games Convention in Leipzig. Träger der Messe ist seit 2018 der Verband der deutschen Games-Branche – game.",
"lang": "de-DE"
}
]
}
},
"protocol": {}
}
The response structure is the same as for the create entity endpoint.