> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Post Function Result For Scheduled Task

> Generate a PlayStream event for the provided function result.

Allowed entity token types: title



## OpenAPI

````yaml /services/playfab/api-references/rest/cloudscript/cloudscript.openapi.json post /CloudScript/PostFunctionResultForScheduledTask
openapi: 3.0.0
info:
  version: '260922'
  title: PlayFab CloudScript API
  description: API methods for executing CloudScript using an Entity Profile
  termsOfService: https://playfab.com/terms/
  contact:
    url: https://community.playfab.com/index.html
  license:
    name: Apache 2.0
    url: https://github.com/PlayFab/API_Specs/blob/master/LICENSE
servers:
  - url: https://{titleId}.playfabapi.com
    description: PlayFab title endpoint
    variables:
      titleId:
        default: your_title_id
        description: Your PlayFab title ID (hex).
security: []
tags:
  - name: Server-Side Cloud Script
    description: Server-Side Cloud Script APIs
paths:
  /CloudScript/PostFunctionResultForScheduledTask:
    post:
      tags:
        - Server-Side Cloud Script
      summary: Post Function Result For Scheduled Task
      description: |-
        Generate a PlayStream event for the provided function result.

        Allowed entity token types: title
      operationId: PostFunctionResultForScheduledTask
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostFunctionResultForScheduledTaskRequest'
      responses:
        '200':
          $ref: '#/components/responses/EmptyResult'
        '400':
          $ref: '#/components/responses/ApiErrorWrapper'
      security:
        - EntityToken: []
components:
  schemas:
    PostFunctionResultForScheduledTaskRequest:
      type: object
      properties:
        CustomTags:
          description: >-
            The optional custom tags associated with the request (e.g. build
            number, external trace identifiers, etc.).
          type: object
        FunctionResult:
          allOf:
            - $ref: '#/components/schemas/ExecuteFunctionResult'
          description: The result of the function execution
        ScheduledTaskId:
          allOf:
            - $ref: '#/components/schemas/NameIdentifier'
          description: The id of the scheduled task that invoked the function.
      required:
        - ScheduledTaskId
        - FunctionResult
      example:
        ScheduledTaskId:
          Name: MyTask
          Id: d739e188-22f6-4d13-a4d5-df2e93d4d2f7
        FunctionResult:
          ExecutionTimeMilliseconds: 367
          FunctionName: LevelCompleted
          FunctionResult:
            newScore: 25
          FunctionResultSize: 43
    ExecuteFunctionResult:
      type: object
      properties:
        Error:
          allOf:
            - $ref: '#/components/schemas/FunctionExecutionError'
          description: Error from the CloudScript Azure Function.
        ExecutionTimeMilliseconds:
          description: The amount of time the function took to execute
          type: number
          x-actualtype: int32
        FunctionName:
          description: The name of the function that executed
          type: string
        FunctionResult:
          description: The object returned from the function, if any
          type: object
        FunctionResultSize:
          description: The size in bytes of the object returned from the function, if any
          type: number
          x-actualtype: int32
        FunctionResultTooLarge:
          description: >-
            Flag indicating if the FunctionResult was too large and was
            subsequently dropped from this event.
          type: boolean
      required:
        - ExecutionTimeMilliseconds
      example:
        ExecutionTimeMilliseconds: 367
        FunctionName: LevelCompleted
        FunctionResult:
          newScore: 25
        FunctionResultSize: 43
    NameIdentifier:
      description: >-
        Identifier by either name or ID. Note that a name may change due to
        renaming, or reused after being deleted. ID is immutable and unique.
      type: object
      properties:
        Id:
          description: Id Identifier, if present
          type: string
        Name:
          description: Name Identifier, if present
          type: string
      example:
        Name: MyTask
        Id: d739e188-22f6-4d13-a4d5-df2e93d4d2f7
    EmptyResult:
      type: object
      properties: {}
    ApiErrorWrapper:
      description: The basic wrapper around every failed API response
      type: object
      properties:
        code:
          description: Numerical HTTP code
          type: integer
        status:
          description: String HTTP code
          type: string
        error:
          description: Playfab error code
          type: string
        errorCode:
          description: Numerical PlayFab error code
          type: integer
        errorMessage:
          description: Description for the PlayFab errorCode
          type: string
        errorDetails:
          description: Detailed description of individual issues with the request object
          type: object
      required:
        - code
        - errorCode
    FunctionExecutionError:
      type: object
      properties:
        Error:
          description: >-
            Error code, such as
            CloudScriptAzureFunctionsExecutionTimeLimitExceeded,
            CloudScriptAzureFunctionsArgumentSizeExceeded,
            CloudScriptAzureFunctionsReturnSizeExceeded or
            CloudScriptAzureFunctionsHTTPRequestError
          type: string
        Message:
          description: Details about the error
          type: string
        StackTrace:
          description: >-
            Point during the execution of the function at which the error
            occurred, if any
          type: string
  responses:
    EmptyResult:
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
                description: >-
                  The Http status code. If X-ReportErrorAsSuccess header is set
                  to true, this will report the actual http error code.
              status:
                type: string
                description: The Http status code as a string.
              data:
                $ref: '#/components/schemas/EmptyResult'
    ApiErrorWrapper:
      description: This is the outer wrapper for all responses with errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiErrorWrapper'
  securitySchemes:
    EntityToken:
      type: apiKey
      in: header
      name: X-EntityToken
      description: >-
        This API requires an Entity Session Token, available from the Entity
        GetEntityToken method.

````

## Related topics

- [Post Function Result For Scheduled Task](/services/playfab/api-references/rest/cloudscript/server-side-cloud-script/post-function-result-for-scheduled-task.md)
- [PlayFab Release Notes 2020](/services/playfab/release-notes/2020.md)
- [Scheduled tasks quickstart](/services/playfab/data-analytics/acting-data/scheduled-tasks/quickstart.md)
- [Scheduled tasks](/services/playfab/data-analytics/acting-data/scheduled-tasks/index.md)
- [title_scheduled_function_executed](/services/playfab/api-references/events/Functions/title-scheduled-function-executed.md)
