question

John Peterson avatar image
John Peterson asked

Can a series of API calls be enveloped in a transaction (atomic operation)?

Dear PlayFab community,

I am writing CloudScript code, and I might have a function that affects several things on a player: Virtual Currency, ItemInstance count, ItemInstance custom data, etc.

Is there any way to make a series of Server API calls that would be scoped within a transaction? That is, if one call fails, unwind all the other calls, but if they're all successful, commit?

I don't see anything like this in the API documentation, but I thought I would ask. Otherwise, we risk having some data integrity issues for a multi-step operation.

Thanks in advance!

apisCloudScript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

No, sorry - being able to string together arbitrary API calls with full rollback is definitely not something we can support at this point. I'd recommend having good error checking and rollback in the script itself - granted, that wouldn't help in a case where the server running the script failed, but that should be exceedingly rare.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.