openapi: 3.0.0
info:
  title: Management Actions
  description: >
    Management Actions APIs for ID360, providing endpoints for managing actions. This API allows users to upload action data, manage selections, and execute actions within the ID360 platform.
    <h2>Available Action Ids</h2>
    <ul>
      <li>move-user</li>
      <li>delete-user</li>
    </ul>
  version: 1.0.0
servers:
  - url: https://id360.manageengine.com/api/v1
    description: API Endpoint
tags:
  - name: management
    description: Management Action Endpoint
paths:
  /management/actions/{action_id}/data:
    get:
      tags:
        - management
      summary: Get Entities
      description: The Get Entities API can be used to get the entities of a specific action.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/actionId'
        - $ref: '#/components/parameters/from'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/criteria'
        - $ref: '#/components/parameters/appAppConfigId'
        - $ref: '#/components/parameters/appOuSelectedIds'
        - $ref: '#/components/parameters/appOuDeselectedId'
        - $ref: '#/components/parameters/appOuExcludeChildOUs'
        - $ref: '#/components/parameters/viewId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/entities'
                  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}/view-columns:
    get:
      tags:
        - management
      summary: Get View Columns
      description: The Get View Columns API can be used to get the view columns of a specific action.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/actionId'
        - $ref: '#/components/parameters/appConfigId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/viewColumns'
        '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
    put:
      tags:
        - management
      summary: Update View Columns
      description: The Update View Columns API can be used to update the view columns of a specific action.
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/actionId'
        - $ref: '#/components/parameters/appConfigId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/viewColumns'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/viewColumns'
        '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.update
            - id360.management.all

  /management/actions/{action_id}/execute:
    post:
      tags:
        - management
      summary: Execute Selection
      description: The Execute Selection API can be used to execute a specific action with the provided selection.'
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
        - $ref: '#/components/parameters/actionId'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/criteria'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/executeRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/executeResponse'
        '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
    criteria:
      in: query
      name: criteria
      schema:
        type: string
      description: 'Criteria-Fw json'
      required: false
      example: '{"first_name":"John"}'
    appAppConfigId:
      name: app.appConfig_id
      in: query
      required: false
      description: 'The ID of the app configuration to be used for the action'
      schema:
        type: string
        example: '2000000000001'
        description: 'ID of the app configuration to be used for the action'
    appConfigId:
      name: app_config_id
      in: query
      required: false
      description: 'The ID of the app configuration to be used for the action'
      schema:
        type: string
        example: '2000000000001'
        description: 'ID of the app configuration to be used for the action'
    appOuSelectedIds:
      name: app.ou.selected_ids
      in: query
      required: false
      description: 'List of OU IDs that are selected'
      schema:
        type: string
        example: '2000000000001,2000000000002'
        description: 'Comma-separated list of OU IDs that are selected'
    appOuDeselectedId:
      name: app.ou.deselected_ids
      in: query
      required: false
      description: 'List of OU IDs that are deSelected'
      schema:
        type: string
        example: '2000000000001,2000000000002'
        description: 'Comma-separated list of OU IDs that are deSelected'
    appOuExcludeChildOUs:
      name: app.ou.exclude_child_ous
      in: query
      required: false
      description: 'Exclude child OUs from the search'
      schema:
        type: boolean
    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'
    entities:
      type: array
      description: 'List of entities in the action.'
      example:
        - id: '2000909435000'
          first_name: John
          last_name: Doe
          email: "johndoe@gmail.com"
          $is_selected: true
        - id: '2000909435001'
          first_name: Jane
          last_name: Smith
          email: "janesmith@gmail.com"
          $is_selected: false
      items:
        type: object
        properties:
          id:
            type: string
            description: Identifier for 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 entity.
            example: john@gmail.com
          $is_selected:
            type: boolean
            description: Indicates if the entity is selected for the action.
            example: true
    viewColumns:
      type: array
      description: 'List of columns to be displayed in the view.'
      example:
        - first_name
        - last_name
        - email
      items:
        type: string
        example: first_name
    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
    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'