title | author | description | ms.author | ms.date | ms.topic | ms.service | keywords | ms.localizationpriority |
---|---|---|---|---|---|---|---|---|
Economy v2 ETags |
wesjong |
Tutorial outlining using the ETags to manage content updates |
wesjong |
03/17/2021 |
article |
playfab |
playfab, commerce, economy, monetization, ugc |
medium |
[!INCLUDE notice]
This guide will go through using ETags to manage item updates.
ETags are a concurrency management option for managing items and their updates.
An ETag
will be returned with the success response when creating or updating a draft item.
{
"Item": {
"Id": "e08acd29-f28a-4cbb-b8d6-7df74c7f0e4a",
"Type": "ugc",
"AlternateIds": [],
"Title": {
"NEUTRAL": "ETag Test"
}
}
}
{
"code": 200,
"status": "OK",
"data": {
"Item": {
"Id": "e08acd29-f28a-4cbb-b8d6-7df74c7f0e4a",
"Type": "ugc",
"Title": {
"NEUTRAL": "ETag Test"
},
...
"ETag": "\"7800e585-0000-0300-0000-623364bf0000\""
}
}
}
This ETag
will be returned from any of the APIs that return the draft item (such as GetDraftItem
, GetEntityDraftItems
, and GetDraftItems
). This ETag
will also be updated every time an update is made with UpdateDraftItem
ETags can be passed in as an optional parameter to UpdateDraftItem
and PublishDraftItem
calls. If passed in, a check will be done between the draft item's ETag
and the passed in parameter. If the two ETags don't match, the request will be rejected.
{
"Id": "e08acd29-f28a-4cbb-b8d6-7df74c7f0e4a",
"ETag": "\"7800e585-0000-0300-0000-623364bf0000\""
}
The above request would publish the item successfully. Providing any other ETag
value would throw an error and reject the request.
ETags are useful where you're expecting multiple users or sources to be simultaneously modifying an item. They allow you to ensure that no data is overridden by another update.