Publish CloudCode
publish_cloud_codePublish server-side game logic (CloudCode) and make it live. This is the only way to run custom code on the server, and the only way to write protected data: the ReadOnly/Internal buckets of a player's UserCustomData and the Runtime scope of the title's data store. The script is plain JavaScript filling a global 'handlers' object, e.g. handlers.claimDailyBonus = function (args, context) { … }. Inside a handler: log.Info/Warning/Error, context.UserID, and server.* (ReadUserData, GetTitleConfig, GetUserCustomData, SetUserCustomData, DeleteUserCustomData, BatchSetUserCustomData, BatchDeleteUserCustomData, GetPublicUserCustomDataOf, GetTitleCustomData, SetTitleCustomData, IncrementTitleCustomData, DeleteTitleCustomData, BatchSetTitleCustomData, BatchDeleteTitleCustomData, GetIntegrationVariable, HttpRequest) — each returns { Success, Error, Data }. No async/await, no imports; 10 seconds wall-clock per call and a per-execution cap on server.* calls. The only way out to the network is server.HttpRequest({ Method, Url, Headers, Body }) — there is no fetch and no XMLHttpRequest; it reaches only publisher-allow-listed hosts over https, and credentials go in as {{secret:NAME}} placeholders (see list_title_secrets), never as literal values. The code REPLACES the previous revision entirely — read get_cloud_code first and send back the full script. Games call handlers through the SDK's client.cloudCode.execute(name, args).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Full JavaScript source of the revision. | |
| comment | No | Short note about what changed. | |
| handlers | No | Optional whitelist of callable handlers; anything not listed is rejected by the server. | |
| title_id | Yes | TitleID. |