openapi: 3.0.0
info:
  title: Device Meta
  description: 'Meta APIs Devices in ID360'
  version: 1.0.0
servers:
  - url: 'https://id360.manageengine.com/api/v1'
    description: 'API Endpoint'
tags:
  - name: device-meta
    description: 'Meta APIs for Devices'
paths:
  #Device Meta-APIs
  /meta/devices:
    get:
      tags:
        - device-meta
      summary: 'Get Device Meta'
      description: 'The Get Device Meta API can be used to get the device meta information.'
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
      responses:
        '200':
          description: 'OK'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/deviceMeta'
        '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.meta.READ

  /meta/device-account-linking:
    get:
      tags:
        - device-meta
      summary: 'Get Device Account Linking Meta'
      description: 'The Get Device Account Linking Meta API can be used to get the device account linking meta information.'
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
      responses:
        '200':
          description: 'OK'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/deviceAccountLinkingMeta'
        '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.meta.READ

  /meta/devices/accounts:
    get:
      tags:
        - device-meta
      summary: 'Get Device Accounts Meta'
      description: 'The Get Device Accounts Meta API can be used to get the device accounts meta information.'
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
      responses:
        '200':
          description: 'OK'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/deviceAccountMeta'
        '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.meta.READ

components:
  parameters:
    acceptHeader:
      name: Accept
      in: header
      schema:
        type: string
      description: 'Accept header for the API'
      required: false
      example: 'application/json'
    factorType:
      name: factor_type
      in: path
      required: true
      description: 'The type of the authnFactor to be fetched'
      example: 'EmailAuthenticator'
      schema:
        type: string
  schemas:
    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.'

    #Device Meta Schemas
    deviceMeta:
      type: object
      properties:
        is_ad_entra_directories_configured:
          type: boolean
          description: 'Indicates if AD Entra directories are configured.'
          example: true
        is_idp_joined_devices_configured:
          type: boolean
          description: 'Indicates if IDP joined devices are configured.'
          example: true
        agent_installation_pending_approval_count:
          type: integer
          description: 'Count of agent installations pending approval.'
          example: 100

    # Device Account Linking Meta-Schemas
    deviceAccountLinkingMeta:
      type: object
      properties:
        allow_sync:
          type: boolean
          description: 'Indicates if account linking is allowed to sync.'
          example: false
        account_permission_levels:
          type: array
          items:
            type: string
            enum:
              - standard
              - admin
          description: 'List of account permission levels.'
          example:
            - standard
            - admin
        account_linking_attributes:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
                description: 'Name of the attribute.'
                example: 'firstName'
              label:
                type: string
                description: 'Label for the attribute.'
                example: 'First Name'
              type:
                type: string
                enum:
                  - attribute
                  - naming_format
                description: 'Type of the attribute.'
                example: 'attribute'
          example:
            - name: 'firstName'
              label: 'First Name'
              type: 'attribute'
            - name: 'localAccountName'
              label: 'Local Account Name'
              type: 'attribute'
            - name: 'customAttr1'
              label: 'firstname+lastname'
              type: 'naming_format'

    # Device Account Meta-Schemas
    deviceAccountMeta:
      type: object
      properties:
        account_permission_levels:
          type: array
          items:
            type: string
            enum:
              - standard
              - admin
          description: 'List of account permission levels.'
          example:
            - standard
            - admin
        has_link_restricted_identity360_users:
          type: boolean
          description: 'Indicates if there are link-restricted Identity360 users.'
          example: true

  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:
            idmpod.meta.read: 'Read Meta data from the account'