---
openapi: 3.0.0

info:
  title: "Subscription API"
  version: "1.0.2"
  description: |-
    <b>Subscription management interface.</b>

    This API offers a web application interface to perform operations
    related to the inventory and management of subscriptions.

    <b>Currently supported operations:</b>

    * Device reconnect api

    <b>Disclaimer:</b>

    * The contents of this document are subject to revision without notice
    due to continued progress in methodology,design and manufacturing.
    Aeris shall have no liability for any error
    or damage of any kind resulting from the use of this document.
    The following are also required for authentication:

  x-api-id: "96f61af0-7bba-45df-8f12-005042cf1e47"
  x-audience: "external-public"

servers:
  - url: https://iot-api.aeris.com/iot/api/subscriptions
    description: API server

paths:
  "/device-reconnect":
    post:
      summary: Create a device reconnect request.
      description: |-
        This API request creates a subscription device reconnect request.
        The change can be requested for one subscription.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceReconnectRequest'
            examples:
              device-reconnect-example:
                value:
                  reattach_required: "false"
                  subscription:
                    identifier_type: IMSI
                    identifier: "100000123456001"
      responses:
        "201":
          description: >
            OK.  Status of response body should be checked if request is still
            in progress.
          allOf:
            - $ref: '#/components/responses/RateLimitedResponse'
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeviceReconnectResponse"
        "429":
          $ref: '#/components/responses/Response_429'
        default:
          description: >
            error occurred - see status code and problem object for more
            information.
          content:
            "application/problem+json":
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - Oauth2_auth:
            - subscription-service.write
components:
  headers:
    Content-Type:
      description: Handle Content-Type
      schema:
        type: string
    X-RateLimit-Limit-Second:
      description: The maximum number of requests allowed in a second.
      schema:
        type: integer
        format: int32
    X-RateLimit-Limit-Minute:
      description: The maximum number of requests allowed in a minute.
      schema:
        type: integer
        format: int32
    X-RateLimit-Remaining-Second:
      description: The number of requests remaining in a second.
      schema:
        type: integer
        format: int32
    X-RateLimit-Remaining-Minute:
      description: The number of requests remaining in a minute.
      schema:
        type: integer
        format: int32
  schemas:
    Subscription:
      title: Subscription
      required:
        - identifier
        - identifier_type
      properties:
        identifier_type:
          description: |-
            The type of the values for the items.
             it is case insensitive, Value can be: IMSI, MSISDN, ICC
          type: string
          x-extensible-enum:
            - IMSI
            - MSISDN
            - ICC
        identifier:
          description: The identifier of the subscription.
            The type of the identifier
            is given by the property "identifier_type".
          type: string
    DeviceReconnectResponse:
      title: DeviceReconnectResponse
      description: |-
        Response type for successfully created subscription request.
      required:
        - subscription_request_id
      type: object
      properties:
        subscription_request_id:
          description: |-
            The request id returned for the subscription change request.
          type: string
      example:
        subscription_request_id: REQ201234567890
    DeviceReconnectRequest:
      title: DeviceReconnectRequest
      description: The model for a subscription device reconnect request.
      type: object
      properties:
        reattach_required:
          description: Value can be true and false, it's case insensitive.
          type: string
          x-extensible-enum:
            - true
            - false
        subscription:
          $ref: '#/components/schemas/Subscription'
      example:
        reattach_required: false
        subscription:
          identifier_type: IMSI
          identifier: "100000123456001"
    Problem:
      type: object
      properties:
        type:
          type: string
          format: uri
          description: |
            An absolute URI that identifies the problem type. When
            dereferenced,it SHOULD provide human-readable documentation
            for the problem type (e.g., using HTML).
        title:
          type: string
          description: |
            A short summary of the problem type in english and readable for
            engineers.
          example: 'Bad request'
        status:
          type: integer
          format: int32
          description: |
            The HTTP status code generated by the origin server for this
            occurrence of the problem.
          minimum: 100
          maximum: 600
          example: 400
        detail:
          type: string
          description: |
            A human readable explanation specific to this occurrence of the
            problem.
          example: 'Uknown identifier_type'
        instance:
          type: string
          nullable: true
          description: |
            An absolute URI that identifies the specific occurrence of the
            problem. It may or may not yield further information if
            dereferenced.
  responses:
    RateLimitedResponse:
      headers:
        X-RateLimit-Limit-Second:
          $ref: '#/components/headers/X-RateLimit-Limit-Second'
        X-RateLimit-Limit-Minute:
          $ref: '#/components/headers/X-RateLimit-Limit-Minute'
        X-RateLimit-Remaining-Second:
          $ref: '#/components/headers/X-RateLimit-Remaining-Second'
        X-RateLimit-Remaining-Minute:
          $ref: '#/components/headers/X-RateLimit-Remaining-Minute'
        Content-Type:
          $ref: '#/components/headers/Content-Type'
    Response_429:
      description: "Too Many Requests"
      allOf:
        - $ref: '#/components/responses/RateLimitedResponse'
      content:
        "application/problem+json":
          schema:
            $ref: '#/components/schemas/Problem'
  securitySchemes:
    Oauth2_auth:
      flows:
        password:
          tokenUrl: https://iot-api.aeris.com/iot/api/auth/token
          scopes:
            subscription-service.read: |
              Access right needed to read from the Subscription service.
            subscription-service.write: |
              Access right needed to write to the Subscription service.
      type: oauth2
