openapi: 3.0.0
info:
  title: Meta
  description: 'Meta APIs documentation'
  version: 1.0.0
servers:
  - url: 'https://id360.manageengine.com/api/v1'
    description: 'API Endpoint'
tags:
  - name: meta
    description: 'Meta endpoint'
paths:
  #Country Meta API
  /meta/countries:
    get:
      tags:
        - meta
      summary: 'Get Countries'
      description: 'The Get Countries API can be used to get the list of all countries.'
      parameters:
        - $ref: '#/components/parameters/acceptHeader'
      responses:
        '200':
          description: 'OK'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/countriesGetAll'
        '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'
  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.'

    # Resource representing a country
    countryResource:
      type: object
      description: Represents a country with its associated codes and dial code.
      properties:
        name:
          type: string
          description: The full name of the country.
          example: "India"
          readOnly: true
        iso_alpha2:
          type: string
          description: The two-letter ISO 3166-1 alpha-2 country code.
          example: "IN"
          readOnly: true
        iso_alpha3:
          type: string
          description: The three-letter ISO 3166-1 alpha-3 country code.
          example: "IND"
          readOnly: true
        numeric_code:
          type: integer
          description: The numeric country code as defined in ISO 3166-1.
          example: 356
          readOnly: true
        dial_code:
          type: string
          description: The international telephone dialing code for the country.
          example: "+91"
          readOnly: true
    countriesGetAll:
      type: array
      description: List of all countries.
      items:
        $ref: '#/components/schemas/countryResource'
      example:
        - name: "India"
          iso_alpha2: "IN"
          iso_alpha3: "IND"
          numeric_code: 356
          dial_code: "+91"
        - name: "United States"
          iso_alpha2: "US"
          iso_alpha3: "USA"
          numeric_code: 840
          dial_code: "+1"

  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'