次の方法で共有


Scheduled Task - Create Actions On Players In Segment Task

Create an ActionsOnPlayersInSegment task, which iterates through all players in a segment to execute action.

POST https://titleId.playfabapi.com/Admin/CreateActionsOnPlayersInSegmentTask

Request Header

Name Required Type Description
X-SecretKey True

string

This API requires a title secret key, available to title admins, from PlayFab Game Manager.

Request Body

Name Required Type Description
IsActive True

boolean

Whether the schedule is active. Inactive schedule will not trigger task execution.

Name True

string

Name of the task. This is a unique identifier for tasks in the title.

Parameter True

ActionsOnPlayersInSegmentTaskParameter

Task details related to segment and action

CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

Description

string

Description the task

Schedule

string

Cron expression for the run schedule of the task. The expression should be in UTC.

Responses

Name Type Description
200 OK

CreateTaskResult

400 Bad Request

ApiErrorWrapper

This is the outer wrapper for all responses with errors

Security

X-SecretKey

This API requires a title secret key, available to title admins, from PlayFab Game Manager.

Type: apiKey
In: header

Definitions

Name Description
Action

The work to be performed on each entity which can only be of one type.

ActionsOnPlayersInSegmentTaskParameter
AddInventoryItemV2Content
ApiErrorWrapper

The basic wrapper around every failed API response

BanPlayerContent
CreateActionsOnPlayerSegmentTaskRequest

Task name is unique within a title. Using a task name that's already taken will cause a name conflict error. Too many create-task requests within a short time will cause a create conflict error.

CreateTaskResult
DeleteInventoryItemV2Content
DeletePlayerContent
ExecuteCloudScriptContent
ExecuteFunctionContent
GrantItemContent
GrantVirtualCurrencyContent
IncrementPlayerStatisticContent
PushNotificationContent
SendEmailContent
SubtractInventoryItemV2Content

Action

The work to be performed on each entity which can only be of one type.

Name Type Description
AddInventoryItemV2Content

AddInventoryItemV2Content

Action content to add inventory item v2

BanPlayerContent

BanPlayerContent

Action content to ban player

DeleteInventoryItemV2Content

DeleteInventoryItemV2Content

Action content to delete inventory item v2

DeletePlayerContent

DeletePlayerContent

Action content to delete player

ExecuteCloudScriptContent

ExecuteCloudScriptContent

Action content to execute cloud script

ExecuteFunctionContent

ExecuteFunctionContent

Action content to execute azure function

GrantItemContent

GrantItemContent

Action content to grant item

GrantVirtualCurrencyContent

GrantVirtualCurrencyContent

Action content to grant virtual currency

IncrementPlayerStatisticContent

IncrementPlayerStatisticContent

Action content to increment player statistic

PushNotificationContent

PushNotificationContent

Action content to send push notification

SendEmailContent

SendEmailContent

Action content to send email

SubtractInventoryItemV2Content

SubtractInventoryItemV2Content

Action content to subtract inventory item v2

ActionsOnPlayersInSegmentTaskParameter

Name Type Description
Actions

Action[]

List of actions to perform on each player in a segment. Each action object can contain only one action type.

SegmentId

string

ID of the segment to perform actions on.

AddInventoryItemV2Content

Name Type Description
Amount

number

Amount of the item to be granted to a player

CollectionId

string

The collection id for where the item will be granted in the player inventory

DurationInSeconds

number

The duration in seconds of the subscription to be granted to a player

ItemId

string

The id of item to be granted to the player

StackId

string

The stack id for where the item will be granted in the player inventory

ApiErrorWrapper

The basic wrapper around every failed API response

Name Type Description
code

integer

Numerical HTTP code

error

string

Playfab error code

errorCode

integer

Numerical PlayFab error code

errorDetails

object

Detailed description of individual issues with the request object

errorMessage

string

Description for the PlayFab errorCode

status

string

String HTTP code

BanPlayerContent

Name Type Description
BanDurationHours

number

Duration(in hours) to ban a player. If not provided, the player will be banned permanently.

BanReason

string

Reason to ban a player

CreateActionsOnPlayerSegmentTaskRequest

Task name is unique within a title. Using a task name that's already taken will cause a name conflict error. Too many create-task requests within a short time will cause a create conflict error.

Name Type Description
CustomTags

object

The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).

Description

string

Description the task

IsActive

boolean

Whether the schedule is active. Inactive schedule will not trigger task execution.

Name

string

Name of the task. This is a unique identifier for tasks in the title.

Parameter

ActionsOnPlayersInSegmentTaskParameter

Task details related to segment and action

Schedule

string

Cron expression for the run schedule of the task. The expression should be in UTC.

CreateTaskResult

Name Type Description
TaskId

string

ID of the task

DeleteInventoryItemV2Content

Name Type Description
CollectionId

string

The collection id for where the item will be removed from the player inventory

ItemId

string

The id of item to be removed from the player

StackId

string

The stack id for where the item will be removed from the player inventory

DeletePlayerContent

ExecuteCloudScriptContent

Name Type Description
CloudScriptMethodArguments

string

Arguments(JSON) to be passed into the cloudscript method

CloudScriptMethodName

string

Cloudscript method name

PublishResultsToPlayStream

boolean

Publish cloudscript results as playstream event

ExecuteFunctionContent

Name Type Description
CloudScriptFunctionArguments

string

Arguments(JSON) to be passed into the cloudscript azure function

CloudScriptFunctionName

string

Cloudscript azure function name

PublishResultsToPlayStream

boolean

Publish results from executing the azure function as playstream event

GrantItemContent

Name Type Description
CatalogVersion

string

The catalog version of the item to be granted to the player

ItemId

string

The id of item to be granted to the player

ItemQuantity

number

Quantity of the item to be granted to a player

GrantVirtualCurrencyContent

Name Type Description
CurrencyAmount

number

Amount of currency to be granted to a player

CurrencyCode

string

Code of the currency to be granted to a player

IncrementPlayerStatisticContent

Name Type Description
StatisticChangeBy

number

Amount(in whole number) to increase the player statistic by

StatisticName

string

Name of the player statistic to be incremented

PushNotificationContent

Name Type Description
Message

string

Text of message to send.

PushNotificationTemplateId

string

Id of the push notification template.

Subject

string

Subject of message to send (may not be displayed in all platforms)

SendEmailContent

Name Type Description
EmailTemplateId

string

The email template id of the email template to send.

SubtractInventoryItemV2Content

Name Type Description
Amount

number

Amount of the item to removed from the player

CollectionId

string

The collection id for where the item will be removed from the player inventory

DurationInSeconds

number

The duration in seconds to be removed from the subscription in the players inventory

ItemId

string

The id of item to be removed from the player

StackId

string

The stack id for where the item will be removed from the player inventory

Error Codes

Name Code
CloudScriptAzureFunctionsArgumentSizeExceeded 1471
InvalidParams 1000
InvalidScheduledTaskName 1256
InvalidTaskSchedule 1257
InvalidVirtualCurrencyCode 1236
OverLimit 1214
PushNotEnabledForAccount 1094
PushNotificationTemplateInvalidSyntax 1419
PushNotificationTemplateNotFound 1417
ScheduledTaskCreateConflict 1255
ScheduledTaskNameConflict 1254
StatisticNotFound 1195