openapi: 3.0.0
info:
  title: Execution
  description: This is the documentation for the Management Actions Execution API in ID360.
  version: 1.0.0
servers:
  - url: https://id360.manageengine.com/api/v1
    description: API Endpoint
tags:
  - name: mgmt-execution
    description: Management Actions Execution Endpoints
paths:
  /management/actions/{action_id}/executions/{execution_id}/status:
    get:
      tags:
        - mgmt-execution
      summary: Get Execution Status
      description: >
        The Get Execution Status API can be used to get the status of a specific action execution.
          <br>
          <strong> Status: </strong>
          <ul>
            <li>yet_to_start</li>
            <li>pending</li>
            <li>completed</li>
            <li>completed_with_errors</li>
            <li>time_out</li>
            <li>interrupted</li>
          </ul>
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/actionId'
        - $ref: '#/components/parameters/executionId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/executionStatus'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.management.read
            - id360.management.all

  /management/actions/{action_id}/executions/{execution_id}:
    get:
      tags:
        - mgmt-execution
      summary: Get Execution
      description: The Get Execution API can be used to get the details of a specific action execution.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/actionId'
        - $ref: '#/components/parameters/executionId'
      responses:
        '200':
          description: 'OK'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/execution'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.management.read
            - id360.management.all

  /management/actions/{action_id}/executions/{execution_id}/data:
    get:
      tags:
        - mgmt-execution
      summary: Get Execution Entities
      description: The Get Execution Entities API can be used to get the entities of a specific action execution.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/actionId'
        - $ref: '#/components/parameters/from'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/executionId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/executionDataList'
                  meta:
                    $ref: '#/components/schemas/meta'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.management.read
            - id360.management.all

  /management/actions/{action_id}/executions/{execution_id}/retry:
    post:
      tags:
        - mgmt-execution
      summary: Retry Execution
      description: The Retry Execution API can be used to retry a specific action execution.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/actionId'
        - $ref: '#/components/parameters/executionId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/retryOrForwardExecution'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.management.write
            - id360.management.all

  /management/actions/{action_id}/executions/{execution_id}/forward/{forward_action_id}:
    post:
      tags:
        - mgmt-execution
      summary: Forward Execution
      description: The Forward Execution API can be used to forward a specific action execution to another action.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/actionId'
        - $ref: '#/components/parameters/executionId'
        - name: forward_action_id
          in: path
          required: true
          description: The ID of the action to which the execution is being forwarded
          example: move-users
          schema:
            type: string
            example: move-users
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/retryOrForwardExecution'
        '401':
          description: 'Unauthorized'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/unauthorized'
        '500':
          description: 'Internal Server Error'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/serverError'
      security:
        - Zoho_Auth:
            - id360.management.write
            - id360.management.all
components:
  parameters:
    authorization:
      name: Authorization
      in: header
      schema:
        type: string
      description: 'Authorization OAuth token for the API'
      required: true
      example: 'Zoho-oauthtoken 1000.41d**************125f'
    acceptHeader:
      name: Accept
      in: header
      schema:
        type: string
      description: 'Accept header for the API'
      required: false
      example: 'application/json'
    actionId:
      name: action_id
      in: path
      required: true
      description: 'The ID of the action to be fetched'
      example: 'move-users'
      schema:
        type: string
        example: 'move-users'
    limit:
      in: query
      name: limit
      schema:
        type: integer
        maximum: 200
        minimum: 1
        default: 200
      description: 'Limit the number of records to be fetched'
      required: false
      example: 50
    filter:
      in: query
      name: filter
      schema:
        type: string
      description: >
        Filter data based on a the provided SCIM filter query. Refer to filter section for more details
        <br>
        <strong>eg:</strong> first_name eq "John" and last_name eq "Doe"
      required: false
      example: first_name eq "John" and last_name eq "Doe"
    from:
      in: query
      name: from
      schema:
        type: integer
        default: 0
      description: 'The starting index for pagination. Default is 0.'
      required: false
      example: 0
    executionId:
      name: execution_id
      in: path
      required: true
      description: 'The ID of the action execution to be fetched'
      example: '2000000000001'
      schema:
        type: string
        example: '2000000000001'
    viewId:
      name: view_id
      in: query
      required: false
      description: 'The ID of the view to be used for the action'
      schema:
        type: string
        example: '2000000000001'
        description: 'ID of the view to be used for the action'
  schemas:
    meta:
      type: object
      properties:
        start_index:
          type: integer
          example: '1'
          description: 'Start index of the response'
        limit:
          type: integer
          example: 200
          description: 'Number of records requested'
        total_no_of_objects:
          type: integer
          example: 2
          description: 'Total number of records available'
    executeRequest:
      type: object
      properties:
        app_config_id:
          type: string
          description: The ID of the app configuration to be used for the action
          example: 2000000000001
          writeOnly: true
        template_input:
          type: object
          description: Input data of the template to be used for the action execution.
          properties:
            id:
              type: string
              description: The ID of the template to be used for the action execution.
              example: 2000000000001
            data:
              type: array
              items:
                type: object
                properties:
                  OPERATION:
                    type: string
                    description: The operation to be performed on the entities for enable or disable action.
                    example: DISABLE
        user_ids:
          type: array
          description: List of user IDs to be included in the action execution.
          example: [ "2000000174051", "2000000174052", "2000000174053" ]
          items:
              type: string
              example: '2000000174051'
    executeResponse:
      type: object
      properties:
        id:
          type: string
          description: The ID of the action execution.
          example: 2000000000001
        status:
          type: string
          description: The status of the action execution.
          enum:
            - yet_to_start
            - pending
            - completed
            - completed_with_errors
            - time_out
            - interrupted
          example: yet_to_start
    execution:
      type: object
      properties:
        id:
          type: string
          description: The ID of the action execution.
          example: 2000000000001
        status:
          type: string
          description: The status of the action execution.
          enum:
            - yet_to_start
            - pending
            - completed
            - completed_with_errors
            - time_out
            - interrupted
          example: completed
        failed_count:
          type: integer
          description: Number of errors encountered during the execution.
          example: 0
        success_count:
          type: integer
          description: Number of successful operations during the execution.
          example: 10
        summary_data:
          type: array
          description: Summary data of the action execution.
          items:
            type: object
            properties:
              label:
                type: string
                description: The label of the summary data.
                example: Logon Hours
              value:
                type: string
                description: The value of the summary data.
                example: 1001001011110100
              type:
                type: string
                description: The type of the summary data.
                enum:
                  - LOGON_HOURS
                  - OTHER_TYPE
                example: LOGON_HOURS
    executionStatus:
      type: string
      description: The status of the action execution.
      enum:
        - yet_to_start
        - pending
        - completed
        - completed_with_errors
        - time_out
        - interrupted
      example: completed
    executionDataList:
      type: array
      items:
        example:
          - user:
              id: "2000909435000"
              first_name: "John"
              last_name: "Doe"
              email: "john@gmail.com"
            status: "success"
            message: "User modified successfully."
          - user:
              id: "2000909435001"
              first_name: "Jane"
              last_name: "Smith"
              email: "jane@gmail.com"
            status: "failure"
            message: "User modification failed due to invalid email format."
        type: object
        properties:
          user:
            type: object
            description: Details of the user entity.
            properties:
              id:
                type: string
                description: The ID of the entity.
                example: 2000909435000
              first_name:
                type: string
                description: First name of the entity.
                example: John
              last_name:
                type: string
                description: Last name of the entity.
                example: Doe
              email:
                type: string
                description: Email address of the user.
                example: john@gmail.com
          status:
            type: string
            description: Status of the action execution for the user.
            enum:
              - success
              - failure
            example: success
          message:
            type: string
            description: Message related to the action execution for the user.
            example: User modified successfully.
    retryOrForwardExecution:
      type: object
      properties:
        view_id:
          type: string
          description: The ID of the view for the action execution.
          example: 2000000000001
    unauthorized:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: '00000101'
            title:
              type: string
              example: 'Unauthorized'
            detail:
              type: string
              example: 'The OAuth token is invalid.'
    serverError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: '00000000'
            title:
              type: string
              example: 'Internal Server Error'
            detail:
              type: string
              example: 'An unexpected internal error has occurred on the server. Please try again later.'
  securitySchemes:
    Zoho_Auth:
      type: oauth2
      x-authorization-example: 'Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f'
      flows:
        authorizationCode:
          authorizationUrl: 'https://accounts.zoho.com/oauth/v2/auth'
          tokenUrl: 'https://accounts.zoho.com/oauth/v2/token'
          scopes:
            id360.management.read: 'Read access for management actions'
            id360.management.write: 'Create/Update/Delete access for management actions'
            id360.management.create: 'Create access for management actions'
            id360.management.delete: 'Delete access for management actions'
            id360.management.update: 'Update access for management actions'
            id360.management.all: 'Perfrom all management actions'