#   Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
################################################################################

swagger: '2.0'
######################################################
# Prolog
######################################################
info:
  version: "v1.1"
  title: "WSO2 API Manager - Publisher API"
  description: |
    This specifies a **RESTful API** for WSO2 **API Manager** - Publisher.

    Please see [full swagger definition](https://raw.githubusercontent.com/wso2/carbon-apimgt/v6.0.4/components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/main/resources/publisher-api.yaml) of the API which is written using [swagger 2.0](http://swagger.io/) specification.
  contact:
    name: "WSO2"
    url: "http://wso2.com/products/api-manager/"
    email: "architecture@wso2.com"
  license:
    name: "Apache 2.0"
    url: "http://www.apache.org/licenses/LICENSE-2.0.html"

######################################################
# The fixed parts of the URLs of the API
######################################################

# The schemes supported by the API
schemes:
  - https
  - http

# The domain of the API.
# This is configured by the customer during deployment.
# The given host is just an example.
host: apis.wso2.com

# The base path of the API.
# Will be prefixed to all paths.
basePath: /api/am/publisher/v1

# The following media types can be passed as input in message bodies of the API.
# The actual media type must be specified in the Content-Type header field of the request.
# The default is json, i.e. the Content-Type header is not needed to
# be set, but supporting it serves extensibility.
consumes:
  - application/json

# The following media types may be passed as output in message bodies of the API.
# The media type(s) consumable by the requester is specified in the Accept header field
# of the corresponding request.
# The actual media type returned will be specified in the Content-Type header field
# of the of the response.
# The default of the Accept header is json, i.e. there is not needed to
# set the value, but supporting it serves extensibility.
produces:
  - application/json

securityDefinitions:
  OAuth2Security:
    type: oauth2
    flow: password
    tokenUrl: https://localhost:9443/token
    scopes:
      openid: Authorize access to user details
      apim:api_view: View API
      apim:api_create: Create API
      apim:api_delete: Delete API
      apim:api_publish: Publish API
      apim:subscription_view: View Subscription
      apim:subscription_block: Block Subscription
      apim:external_services_discover: Discover External Services
      apim:threat_protection_policy_create: Create threat protection policies
      apim:threat_protection_policy_manage: Update and delete threat protection policies
      apim:document_create: Create API documents
      apim:document_manage: Update and delete API documents
      apim:mediation_policy_view: View mediation policies
      apim:mediation_policy_create: Create mediation policies
      apim:mediation_policy_manage: Update and delete mediation policies
      apim:client_certificates_view: View client certificates
      apim:client_certificates_add: Add client certificates
      apim:client_certificates_update: Update and delete client certificates
      apim:ep_certificates_view: View backend endpoint certificates
      apim:ep_certificates_add: Add backend endpoint certificates
      apim:ep_certificates_update: Update and delete backend endpoint certificates
      apim:publisher_settings: Retrieve store settings
      apim:pub_alert_manage: Get/ subscribe/ configure publisher alerts.

security:
  - OAuth2Security:
    - apim:api_view

######################################################
# The "API Collection" resource APIs
######################################################
paths:
  /apis:

#-----------------------------------------------------
# Retrieving the list of all APIs qualifying under a given search condition
#-----------------------------------------------------
    get:
      summary: |
        Retrieve/Search APIs
      description: |
        This operation provides you a list of available APIs qualifying under a given search condition.

        Each retrieved API is represented with a minimal amount of attributes. If you want to get complete details of an API, you need to use **Get details of an API** operation.
      security:
        - OAuth2Security:
            - apim:api_view
      x-examples:
        $ref: docs/examples/apis/apis_get.yaml
      parameters:
        - $ref : '#/parameters/limit'
        - $ref : '#/parameters/offset'
        - $ref : '#/parameters/requestedTenant'
        - name : query
          in: query
          description: |
            **Search condition**.

            You can search in attributes by using an **"<attribute>:"** modifier.

            Eg.
            "provider:wso2" will match an API if the provider of the API contains "wso2".
            "provider:"wso2"" will match an API if the provider of the API is exactly "wso2".
            "status:PUBLISHED" will match an API if the API is in PUBLISHED state.
            "label:external" will match an API if it contains a Microgateway label called "external".

            Also you can use combined modifiers
            Eg.
            name:pizzashack version:v1 will match an API if the name of the API is pizzashack and version is v1.

            Supported attribute modifiers are [**version, context, name, status,
            description, subcontext, doc, provider, label**]

            If no advanced attribute modifier has been specified,  the API names containing
            the search term will be returned as a result.

            Please note that you need to use encoded URL (URL encoding) if you are using a client which does not support URL encoding (such as curl)

          type: string
        - $ref : "#/parameters/If-None-Match"
        - $ref : "#/parameters/expand"
        - $ref : "#/parameters/Accept"
      tags:
        - APIs
      responses:
        200:
          description: |
            OK.
            List of qualifying APIs is returned.
          schema:
            $ref: '#/definitions/APIList'
          headers:
            Content-Type:
              description: The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'
#-----------------------------------------------------
# Create a new API
#-----------------------------------------------------
    post:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X POST -d @data.json https://127.0.0.1:9443/api/am/publisher/v1/apis"
      x-wso2-request: "POST https://127.0.0.1:9443/api/am/publisher/v1/apis\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\n\n{\r\n   \"name\": \"PizzaShackAPI\",\r\n   \"description\": \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\r\\n\",\r\n   \"context\": \"/pizzashack\",\r\n   \"version\": \"1.0.0\",\r\n   \"provider\": \"admin\",\r\n   \"wsdlUri\": null,\r\n   \"lifeCycleStatus\": \"PUBLISHED\",\r\n   \"responseCachingEnabled\": false,\r\n   \"cacheTimeout\": 300,\r\n   \"destinationStatsEnabled\": false,\r\n   \"isDefaultVersion\": false,\r\n   \"transport\":    [\r\n      \"http\",\r\n      \"https\"\r\n   ],\r\n   \"tags\": [\"pizza\"],\r\n   \"policies\": [\"Unlimited\"],\r\n   \"maxTps\":    {\r\n      \"sandbox\": 5000,\r\n      \"production\": 1000\r\n   },\r\n   \"visibility\": \"PUBLIC\",\r\n   \"visibleRoles\": [],\r\n   \"visibleTenants\": [],\r\n   \"endpointConfig\": \"{\\\"production_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"sandbox_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"endpoint_type\\\":\\\"http\\\"}\",\r\n   \"endpointSecurity\":    {\r\n      \"username\": \"user\",\r\n      \"type\": \"basic\",\r\n      \"password\": \"pass\"\r\n   },\r\n   \"gatewayEnvironments\": \"Production and Sandbox\",\r\n   \"sequences\": [],\r\n   \"subscriptionAvailability\": null,\r\n   \"subscriptionAvailableTenants\": [],\r\n   \"businessInformation\":    {\r\n      \"businessOwnerEmail\": \"marketing@pizzashack.com\",\r\n      \"technicalOwnerEmail\": \"architecture@pizzashack.com\",\r\n      \"technicalOwner\": \"John Doe\",\r\n      \"businessOwner\": \"Jane Roe\"\r\n   },\r\n   \"corsConfiguration\":    {\r\n      \"accessControlAllowOrigins\": [\"*\"],\r\n      \"accessControlAllowHeaders\":       [\r\n         \"authorization\",\r\n         \"Access-Control-Allow-Origin\",\r\n         \"Content-Type\",\r\n         \"SOAPAction\"\r\n      ],\r\n      \"accessControlAllowMethods\":       [\r\n         \"GET\",\r\n         \"PUT\",\r\n         \"POST\",\r\n         \"DELETE\",\r\n         \"PATCH\",\r\n         \"OPTIONS\"\r\n      ],\r\n      \"accessControlAllowCredentials\": false,\r\n      \"corsConfigurationEnabled\": false\r\n   }\r\n}"
      x-wso2-response: "HTTP/1.1 201 Created\nLocation: https://127.0.0.1:9443/api/am/publisher/v1/apis/7a2298c4-c905-403f-8fac-38c73301631f\nContent-Type: application/json\n\n{\r\n   \"id\": \"7a2298c4-c905-403f-8fac-38c73301631f\",\r\n   \"name\": \"PizzaShackAPI\",\r\n   \"description\": \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\r\\n\",\r\n   \"context\": \"/pizzashack\",\r\n   \"version\": \"1.0.0\",\r\n   \"provider\": \"admin\",\r\n   \"wsdlUri\": null,\r\n   \"lifeCycleStatus\": \"CREATED\",\r\n   \"responseCachingEnabled\": false,\r\n   \"cacheTimeout\": 300,\r\n   \"destinationStatsEnabled\": null,\r\n   \"isDefaultVersion\": false,\r\n   \"transport\":    [\r\n      \"http\",\r\n      \"https\"\r\n   ],\r\n   \"tags\": [\"pizza\"],\r\n   \"policies\": [\"Unlimited\"],\r\n   \"maxTps\":    {\r\n      \"sandbox\": 5000,\r\n      \"production\": 1000\r\n   },\r\n   \"visibility\": \"PUBLIC\",\r\n   \"visibleRoles\": [],\r\n   \"visibleTenants\": [],\r\n   \"endpointConfig\": \"{\\\"production_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"sandbox_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"endpoint_type\\\":\\\"http\\\"}\",\r\n   \"endpointSecurity\":    {\r\n      \"username\": \"user\",\r\n      \"type\": \"basic\",\r\n      \"password\": \"pass\"\r\n   },\r\n   \"gatewayEnvironments\": \"Production and Sandbox\",\r\n   \"sequences\": [],\r\n   \"subscriptionAvailability\": null,\r\n   \"subscriptionAvailableTenants\": [],\r\n   \"businessInformation\":    {\r\n      \"businessOwnerEmail\": \"marketing@pizzashack.com\",\r\n      \"technicalOwnerEmail\": \"architecture@pizzashack.com\",\r\n      \"technicalOwner\": \"John Doe\",\r\n      \"businessOwner\": \"Jane Roe\"\r\n   },\r\n   \"corsConfiguration\":    {\r\n      \"accessControlAllowOrigins\": [\"*\"],\r\n      \"accessControlAllowHeaders\":       [\r\n         \"authorization\",\r\n         \"Access-Control-Allow-Origin\",\r\n         \"Content-Type\",\r\n         \"SOAPAction\"\r\n      ],\r\n      \"accessControlAllowMethods\":       [\r\n         \"GET\",\r\n         \"PUT\",\r\n         \"POST\",\r\n         \"DELETE\",\r\n         \"PATCH\",\r\n         \"OPTIONS\"\r\n      ],\r\n      \"accessControlAllowCredentials\": false,\r\n      \"corsConfigurationEnabled\": false\r\n   }\r\n}"
      security:
        - OAuth2Security:
          - apim:api_create
      summary: Create a new API
      description: |
        This operation can be used to create a new API specifying the details of the API in the payload. The new API will be in `CREATED` state.

        There is a special capability for a user who has `APIM Admin` permission such that he can create APIs on behalf of other users. For that he can to specify `"provider" : "some_other_user"` in the payload so that the API's creator will be shown as `some_other_user` in the UI.
      x-examples:
        $ref: docs/examples/apis/apis_post.yaml
      parameters:
        - in: body
          name: body
          description: |
            API object that needs to be added
          required: true
          schema:
            $ref: '#/definitions/API'
        - in: query
          name: openAPIVersion
          description: Open api version
          type: string
          enum:
            - V2
            - V3
      tags:
        - APIs
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
            Location header contains URL of newly created entity.
          schema:
            $ref: '#/definitions/API'
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        415:
          description: |
            Unsupported Media Type.
            The entity of the request was in a not supported format.
          schema:
            $ref: '#/definitions/Error'

######################################################
# The "Individual API" resource APIs
######################################################
  /apis/{apiId}:

#-----------------------------------------------------
# Retrieve the details of an API definition
#-----------------------------------------------------
    get:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://127.0.0.1:9443/api/am/publisher/v1/apis/7a2298c4-c905-403f-8fac-38c73301631f"
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/apis/7a2298c4-c905-403f-8fac-38c73301631f
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\r\n   \"id\": \"7a2298c4-c905-403f-8fac-38c73301631f\",\r\n   \"name\": \"PizzaShackAPI\",\r\n   \"description\": \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\r\\n\",\r\n   \"context\": \"/pizzashack\",\r\n   \"version\": \"1.0.0\",\r\n   \"provider\": \"admin\",\r\n   \"endpointId\": \"{\\\"paths\\\":{\\\"/order\\\":{\\\"post\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-policy\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Create a new Order\\\",\\\"parameters\\\":[{\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Order object that needs to be added\\\",\\\"name\\\":\\\"body\\\",\\\"required\\\":true,\\\"in\\\":\\\"body\\\"}],\\\"responses\\\":{\\\"201\\\":{\\\"headers\\\":{\\\"Location\\\":{\\\"description\\\":\\\"The URL of the newly created resource.\\\",\\\"type\\\":\\\"string\\\"}},\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Created.\\\"}}}},\\\"/menu\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-policy\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Return a list of available menu items\\\",\\\"parameters\\\":[],\\\"responses\\\":{\\\"200\\\":{\\\"headers\\\":{},\\\"schema\\\":{\\\"title\\\":\\\"Menu\\\",\\\"properties\\\":{\\\"list\\\":{\\\"items\\\":{\\\"$ref\\\":\\\"#/definitions/MenuItem\\\"},\\\"type\\\":\\\"array\\\"}},\\\"type\\\":\\\"object\\\"},\\\"description\\\":\\\"OK.\\\"}}}}},\\\"schemes\\\":[\\\"https\\\"],\\\"produces\\\":[\\\"application/json\\\"],\\\"swagger\\\":\\\"2.0\\\",\\\"definitions\\\":{\\\"MenuItem\\\":{\\\"title\\\":\\\"Pizza menu Item\\\",\\\"properties\\\":{\\\"price\\\":{\\\"type\\\":\\\"string\\\"},\\\"description\\\":{\\\"type\\\":\\\"string\\\"},\\\"name\\\":{\\\"type\\\":\\\"string\\\"},\\\"image\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"name\\\"]},\\\"Order\\\":{\\\"title\\\":\\\"Pizza Order\\\",\\\"properties\\\":{\\\"customerName\\\":{\\\"type\\\":\\\"string\\\"},\\\"delivered\\\":{\\\"type\\\":\\\"boolean\\\"},\\\"address\\\":{\\\"type\\\":\\\"string\\\"},\\\"pizzaType\\\":{\\\"type\\\":\\\"string\\\"},\\\"creditCardNumber\\\":{\\\"type\\\":\\\"string\\\"},\\\"quantity\\\":{\\\"type\\\":\\\"number\\\"},\\\"orderId\\\":{\\\"type\\\":\\\"integer\\\"}},\\\"required\\\":[\\\"orderId\\\"]}},\\\"consumes\\\":[\\\"application/json\\\"],\\\"info\\\":{\\\"title\\\":\\\"PizzaShackAPI\\\",\\\"description\\\":\\\"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\\\n\\\",\\\"license\\\":{\\\"name\\\":\\\"Apache 2.0\\\",\\\"url\\\":\\\"http://www.apache.org/licenses/LICENSE-2.0.html\\\"},\\\"contact\\\":{\\\"email\\\":\\\"architecture@pizzashack.com\\\",\\\"name\\\":\\\"John Doe\\\",\\\"url\\\":\\\"http://www.pizzashack.com\\\"},\\\"version\\\":\\\"1.0.0\\\"}}\",\r\n   \"wsdlUri\": null,\r\n   \"lifeCycleStatus\": \"CREATED\",\r\n   \"responseCachingEnabled\": false,\r\n   \"cacheTimeout\": 300,\r\n   \"destinationStatsEnabled\": null,\r\n   \"isDefaultVersion\": false,\r\n   \"transport\":    [\r\n      \"http\",\r\n      \"https\"\r\n   ],\r\n   \"tags\": [\"pizza\"],\r\n   \"policies\": [\"Unlimited\"],\r\n   \"maxTps\":    {\r\n      \"sandbox\": 5000,\r\n      \"production\": 1000\r\n   },\r\n   \"visibility\": \"PUBLIC\",\r\n   \"visibleRoles\": [],\r\n   \"visibleTenants\": [],\r\n   \"endpointConfig\": \"{\\\"production_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"sandbox_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"endpoint_type\\\":\\\"http\\\"}\",\r\n   \"endpointSecurity\":    {\r\n      \"username\": \"user\",\r\n      \"type\": \"basic\",\r\n      \"password\": \"pass\"\r\n   },\r\n   \"gatewayEnvironments\": \"Production and Sandbox\",\r\n   \"sequences\": [],\r\n   \"subscriptionAvailability\": null,\r\n   \"subscriptionAvailableTenants\": [],\r\n   \"businessInformation\":    {\r\n      \"businessOwnerEmail\": \"marketing@pizzashack.com\",\r\n      \"technicalOwnerEmail\": \"architecture@pizzashack.com\",\r\n      \"technicalOwner\": \"John Doe\",\r\n      \"businessOwner\": \"Jane Roe\"\r\n   },\r\n   \"corsConfiguration\":    {\r\n      \"accessControlAllowOrigins\": [\"*\"],\r\n      \"accessControlAllowHeaders\":       [\r\n         \"authorization\",\r\n         \"Access-Control-Allow-Origin\",\r\n         \"Content-Type\",\r\n         \"SOAPAction\"\r\n      ],\r\n      \"accessControlAllowMethods\":       [\r\n         \"GET\",\r\n         \"PUT\",\r\n         \"POST\",\r\n         \"DELETE\",\r\n         \"PATCH\",\r\n         \"OPTIONS\"\r\n      ],\r\n      \"accessControlAllowCredentials\": false,\r\n      \"corsConfigurationEnabled\": false\r\n   }\r\n}"
      summary: Get details of an API
      description: |
        Using this operation, you can retrieve complete details of a single API. You need to provide the Id of the API to retrive it.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/requestedTenant'
        - $ref: '#/parameters/If-None-Match'
      x-examples:
        $ref: docs/examples/apis/apis_id_get.yaml
      security:
        - OAuth2Security:
            - apim:api_view
      tags:
        - APIs
      responses:
        200:
          description: |
            OK.
            Requested API is returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
          schema:
            $ref: '#/definitions/API'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

#-----------------------------------------------------
# Update the definition of an API
#-----------------------------------------------------
    put:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X PUT -d @data.json https://127.0.0.1:9443/api/am/publisher/v1/apis/7a2298c4-c905-403f-8fac-38c73301631f"
      x-wso2-request: "PUT https://127.0.0.1:9443/api/am/publisher/v1/apis/7a2298c4-c905-403f-8fac-38c73301631f\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\nContent-Type: application/json\n\n{\r\n   \"id\": \"7a2298c4-c905-403f-8fac-38c73301631f\",\r\n   \"name\": \"PizzaShackAPI\",\r\n   \"description\": \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\r\\n\",\r\n   \"context\": \"/pizzashack\",\r\n   \"version\": \"1.0.0\",\r\n   \"provider\": \"admin\",\r\n   \"endpointId\": \"{\\\"paths\\\":{\\\"/order\\\":{\\\"post\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-policy\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Create a new Order\\\",\\\"parameters\\\":[{\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Order object that needs to be added\\\",\\\"name\\\":\\\"body\\\",\\\"required\\\":true,\\\"in\\\":\\\"body\\\"}],\\\"responses\\\":{\\\"201\\\":{\\\"headers\\\":{\\\"Location\\\":{\\\"description\\\":\\\"The URL of the newly created resource.\\\",\\\"type\\\":\\\"string\\\"}},\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Created.\\\"}}}},\\\"/menu\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-policy\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Return a list of available menu items\\\",\\\"parameters\\\":[],\\\"responses\\\":{\\\"200\\\":{\\\"headers\\\":{},\\\"schema\\\":{\\\"title\\\":\\\"Menu\\\",\\\"properties\\\":{\\\"list\\\":{\\\"items\\\":{\\\"$ref\\\":\\\"#/definitions/MenuItem\\\"},\\\"type\\\":\\\"array\\\"}},\\\"type\\\":\\\"object\\\"},\\\"description\\\":\\\"OK.\\\"}}}}},\\\"schemes\\\":[\\\"https\\\"],\\\"produces\\\":[\\\"application/json\\\"],\\\"swagger\\\":\\\"2.0\\\",\\\"definitions\\\":{\\\"MenuItem\\\":{\\\"title\\\":\\\"Pizza menu Item\\\",\\\"properties\\\":{\\\"price\\\":{\\\"type\\\":\\\"string\\\"},\\\"description\\\":{\\\"type\\\":\\\"string\\\"},\\\"name\\\":{\\\"type\\\":\\\"string\\\"},\\\"image\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"name\\\"]},\\\"Order\\\":{\\\"title\\\":\\\"Pizza Order\\\",\\\"properties\\\":{\\\"customerName\\\":{\\\"type\\\":\\\"string\\\"},\\\"delivered\\\":{\\\"type\\\":\\\"boolean\\\"},\\\"address\\\":{\\\"type\\\":\\\"string\\\"},\\\"pizzaType\\\":{\\\"type\\\":\\\"string\\\"},\\\"creditCardNumber\\\":{\\\"type\\\":\\\"string\\\"},\\\"quantity\\\":{\\\"type\\\":\\\"number\\\"},\\\"orderId\\\":{\\\"type\\\":\\\"integer\\\"}},\\\"required\\\":[\\\"orderId\\\"]}},\\\"consumes\\\":[\\\"application/json\\\"],\\\"info\\\":{\\\"title\\\":\\\"PizzaShackAPI\\\",\\\"description\\\":\\\"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\\\n\\\",\\\"license\\\":{\\\"name\\\":\\\"Apache 2.0\\\",\\\"url\\\":\\\"http://www.apache.org/licenses/LICENSE-2.0.html\\\"},\\\"contact\\\":{\\\"email\\\":\\\"architecture@pizzashack.com\\\",\\\"name\\\":\\\"John Doe\\\",\\\"url\\\":\\\"http://www.pizzashack.com\\\"},\\\"version\\\":\\\"1.0.0\\\"}}\",\r\n   \"wsdlUri\": null,\r\n   \"lifeCycleStatus\": \"CREATED\",\r\n   \"responseCachingEnabled\": false,\r\n   \"cacheTimeout\": 300,\r\n   \"destinationStatsEnabled\": null,\r\n   \"isDefaultVersion\": false,\r\n   \"transport\":    [\r\n      \"https\"\r\n   ],\r\n   \"tags\": [\"pizza\",\"chicken\"],\r\n   \"policies\": [\"Unlimited\"],\r\n   \"maxTps\":    {\r\n      \"sandbox\": 500,\r\n      \"production\": 100\r\n   },\r\n   \"visibility\": \"PUBLIC\",\r\n   \"visibleRoles\": [],\r\n   \"visibleTenants\": [],\r\n   \"endpointConfig\": \"{\\\"production_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"sandbox_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"endpoint_type\\\":\\\"http\\\"}\",\r\n   \"endpointSecurity\":    {\r\n      \"username\": \"user\",\r\n      \"type\": \"basic\",\r\n      \"password\": \"pass\"\r\n   },\r\n   \"gatewayEnvironments\": \"Production and Sandbox\",\r\n   \"sequences\": [],\r\n   \"subscriptionAvailability\": null,\r\n   \"subscriptionAvailableTenants\": [],\r\n   \"businessInformation\":    {\r\n      \"businessOwnerEmail\": \"marketing@pizzashack.com\",\r\n      \"technicalOwnerEmail\": \"architecture@pizzashack.com\",\r\n      \"technicalOwner\": \"John Doe\",\r\n      \"businessOwner\": \"Jane Roe\"\r\n   },\r\n   \"corsConfiguration\":    {\r\n      \"accessControlAllowOrigins\": [\"*\"],\r\n      \"accessControlAllowHeaders\":       [\r\n         \"authorization\",\r\n         \"Access-Control-Allow-Origin\",\r\n         \"Content-Type\",\r\n         \"SOAPAction\"\r\n      ],\r\n      \"accessControlAllowMethods\":       [\r\n         \"GET\",\r\n         \"PUT\",\r\n         \"POST\",\r\n         \"DELETE\",\r\n         \"PATCH\",\r\n         \"OPTIONS\"\r\n      ],\r\n      \"accessControlAllowCredentials\": false,\r\n      \"corsConfigurationEnabled\": false\r\n   }\r\n}"
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\r\n   \"id\": \"7a2298c4-c905-403f-8fac-38c73301631f\",\r\n   \"name\": \"PizzaShackAPI\",\r\n   \"description\": \"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\r\\n\",\r\n   \"context\": \"/pizzashack\",\r\n   \"version\": \"1.0.0\",\r\n   \"provider\": \"admin\",\r\n   \"endpointId\": \"{\\\"paths\\\":{\\\"/order\\\":{\\\"post\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-policy\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Create a new Order\\\",\\\"parameters\\\":[{\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Order object that needs to be added\\\",\\\"name\\\":\\\"body\\\",\\\"required\\\":true,\\\"in\\\":\\\"body\\\"}],\\\"responses\\\":{\\\"201\\\":{\\\"headers\\\":{\\\"Location\\\":{\\\"description\\\":\\\"The URL of the newly created resource.\\\",\\\"type\\\":\\\"string\\\"}},\\\"schema\\\":{\\\"$ref\\\":\\\"#/definitions/Order\\\"},\\\"description\\\":\\\"Created.\\\"}}}},\\\"/menu\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application & Application User\\\",\\\"x-throttling-policy\\\":\\\"Unlimited\\\",\\\"description\\\":\\\"Return a list of available menu items\\\",\\\"parameters\\\":[],\\\"responses\\\":{\\\"200\\\":{\\\"headers\\\":{},\\\"schema\\\":{\\\"title\\\":\\\"Menu\\\",\\\"properties\\\":{\\\"list\\\":{\\\"items\\\":{\\\"$ref\\\":\\\"#/definitions/MenuItem\\\"},\\\"type\\\":\\\"array\\\"}},\\\"type\\\":\\\"object\\\"},\\\"description\\\":\\\"OK.\\\"}}}}},\\\"schemes\\\":[\\\"https\\\"],\\\"produces\\\":[\\\"application/json\\\"],\\\"swagger\\\":\\\"2.0\\\",\\\"definitions\\\":{\\\"MenuItem\\\":{\\\"title\\\":\\\"Pizza menu Item\\\",\\\"properties\\\":{\\\"price\\\":{\\\"type\\\":\\\"string\\\"},\\\"description\\\":{\\\"type\\\":\\\"string\\\"},\\\"name\\\":{\\\"type\\\":\\\"string\\\"},\\\"image\\\":{\\\"type\\\":\\\"string\\\"}},\\\"required\\\":[\\\"name\\\"]},\\\"Order\\\":{\\\"title\\\":\\\"Pizza Order\\\",\\\"properties\\\":{\\\"customerName\\\":{\\\"type\\\":\\\"string\\\"},\\\"delivered\\\":{\\\"type\\\":\\\"boolean\\\"},\\\"address\\\":{\\\"type\\\":\\\"string\\\"},\\\"pizzaType\\\":{\\\"type\\\":\\\"string\\\"},\\\"creditCardNumber\\\":{\\\"type\\\":\\\"string\\\"},\\\"quantity\\\":{\\\"type\\\":\\\"number\\\"},\\\"orderId\\\":{\\\"type\\\":\\\"integer\\\"}},\\\"required\\\":[\\\"orderId\\\"]}},\\\"consumes\\\":[\\\"application/json\\\"],\\\"info\\\":{\\\"title\\\":\\\"PizzaShackAPI\\\",\\\"description\\\":\\\"This document describe a RESTFul API for Pizza Shack online pizza delivery store.\\\\n\\\",\\\"license\\\":{\\\"name\\\":\\\"Apache 2.0\\\",\\\"url\\\":\\\"http://www.apache.org/licenses/LICENSE-2.0.html\\\"},\\\"contact\\\":{\\\"email\\\":\\\"architecture@pizzashack.com\\\",\\\"name\\\":\\\"John Doe\\\",\\\"url\\\":\\\"http://www.pizzashack.com\\\"},\\\"version\\\":\\\"1.0.0\\\"}}\",\r\n   \"wsdlUri\": null,\r\n   \"lifeCycleStatus\": \"CREATED\",\r\n   \"responseCachingEnabled\": false,\r\n   \"cacheTimeout\": 300,\r\n   \"destinationStatsEnabled\": null,\r\n   \"isDefaultVersion\": false,\r\n   \"transport\": [\"https\"],\r\n   \"tags\":    [\r\n      \"chicken\",\r\n      \"pizza\"\r\n   ],\r\n   \"policies\": [\"Unlimited\"],\r\n   \"maxTps\":    {\r\n      \"sandbox\": 500,\r\n      \"production\": 100\r\n   },\r\n   \"visibility\": \"PUBLIC\",\r\n   \"visibleRoles\": [],\r\n   \"visibleTenants\": [],\r\n   \"endpointConfig\": \"{\\\"production_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"sandbox_endpoints\\\":{\\\"url\\\":\\\"https://localhost:9443/am/sample/pizzashack/v1/api/\\\",\\\"config\\\":null},\\\"endpoint_type\\\":\\\"http\\\"}\",\r\n   \"endpointSecurity\":    {\r\n      \"username\": \"user\",\r\n      \"type\": \"basic\",\r\n      \"password\": \"pass\"\r\n   },\r\n   \"gatewayEnvironments\": \"Production and Sandbox\",\r\n   \"sequences\": [],\r\n   \"subscriptionAvailability\": null,\r\n   \"subscriptionAvailableTenants\": [],\r\n   \"businessInformation\":    {\r\n      \"businessOwnerEmail\": \"marketing@pizzashack.com\",\r\n      \"technicalOwnerEmail\": \"architecture@pizzashack.com\",\r\n      \"technicalOwner\": \"John Doe\",\r\n      \"businessOwner\": \"Jane Roe\"\r\n   },\r\n   \"corsConfiguration\":    {\r\n      \"accessControlAllowOrigins\": [\"*\"],\r\n      \"accessControlAllowHeaders\":       [\r\n         \"authorization\",\r\n         \"Access-Control-Allow-Origin\",\r\n         \"Content-Type\",\r\n         \"SOAPAction\"\r\n      ],\r\n      \"accessControlAllowMethods\":       [\r\n         \"GET\",\r\n         \"PUT\",\r\n         \"POST\",\r\n         \"DELETE\",\r\n         \"PATCH\",\r\n         \"OPTIONS\"\r\n      ],\r\n      \"accessControlAllowCredentials\": false,\r\n      \"corsConfigurationEnabled\": false\r\n   }\r\n}"
      security:
        - OAuth2Security:
          - apim:api_create
          - apim:api_publish
      summary: Update an API
      description: |
        This operation can be used to update an existing API.
        But the properties `name`, `version`, `context`, `provider`, `state` will not be changed by this operation.
      parameters:
        - $ref: '#/parameters/apiId'
        - in: body
          name: body
          description: |
            API object that needs to be added
          required: true
          schema:
            $ref: '#/definitions/API'
        - $ref: '#/parameters/If-Match'
      tags:
        - APIs
      responses:
        200:
          description: |
            OK.
            Successful response with updated API object
          schema:
            $ref: '#/definitions/API'
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        403:
          description: |
            Forbidden.
            The request must be conditional but no condition has been specified.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        409:
          description: |
            Conflict.
            The request could not be completed due to a conflict with the current state of the target resource.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

#-----------------------------------------------------
# Delete the definition of an API
#-----------------------------------------------------
    delete:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X DELETE https://127.0.0.1:9443/api/am/publisher/v1/apis/6fb74674-4ab8-4b52-9886-f9a376985060"
      x-wso2-request: |
        DELETE https://127.0.0.1:9443/api/am/publisher/v1/apis/6fb74674-4ab8-4b52-9886-f9a376985060
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK"
      security:
        - OAuth2Security:
          - apim:api_delete
      summary: Delete an API
      description: |
        This operation can be used to delete an existing API proving the Id of the API.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/If-Match'
      tags:
        - APIs
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
        403:
          description: |
            Forbidden.
            The request must be conditional but no condition has been specified.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Resource to be deleted does not exist.
          schema:
            $ref: '#/definitions/Error'
        409:
          description: |
            Conflict.
            The request could not be completed due to a conflict with the current state of the target resource.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

################################################################
# The swagger resource of "Individual API" resource APIs
################################################################

  /apis/{apiId}/swagger:
#-----------------------------------------------------
# Retrieve the API swagger definition
#-----------------------------------------------------
    get:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/swagger"
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/swagger
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\nContent-Length: 329\n\n{\n   \"paths\": {\"/*\": {\"get\":    {\n      \"x-auth-type\": \"Application\",\n      \"x-throttling-policy\": \"Unlimited\",\n      \"responses\": {\"200\": {\"description\": \"OK\"}}\n   }}},\n   \"swagger\": \"2.0\",\n   \"info\":    {\n      \"title\": \"PhoneVerification\",\n      \"description\": \"Verify a phone number\",\n      \"contact\":       {\n         \"email\": \"xx@ee.com\",\n         \"name\": \"xx\"\n      },\n      \"version\": \"1.0.0\"\n   }\n}"
      summary: Get swagger definition
      description: |
        This operation can be used to retrieve the swagger definition of an API.
      security:
        - OAuth2Security:
            - apim:api_view
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - APIs
      responses:
        200:
          schema:
             type: string
             example: ""
          description: |
            OK.
            Requested swagger document of the API is returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

#-----------------------------------------------------
# Update the API swagger definition
#-----------------------------------------------------
    put:
      consumes:
        - multipart/form-data
      x-wso2-curl: "curl -k -H \"Authorization:Bearer 5311eca3-8ac8-354e-ab36-7e2fdd6a4013\" -F endpointId=\"{\\\"paths\\\":{\\\"\\/*\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application\\\",\\\"x-throttling-policy\\\":\\\"Unlimited\\\",\\\"responses\\\":{\\\"200\\\":{\\\"description\\\":\\\"OK\\\"}}}}},\\\"swagger\\\":\\\"2.0\\\",\\\"info\\\":{\\\"title\\\":\\\"PhoneVerification\\\",\\\"description\\\":\\\"Verify a phone number\\\",\\\"contact\\\":{\\\"email\\\":\\\"xx@ee.com\\\",\\\"name\\\":\\\"xx\\\"},\\\"version\\\":\\\"1.0.0\\\"}}\" -X PUT \"https://127.0.0.1:9443/api/am/publisher/v1/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/swagger\""
      x-wso2-request: |
        PUT https://127.0.0.1:9443/api/am/publisher/v1/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/swagger
        Authorization:Bearer 5311eca3-8ac8-354e-ab36-7e2fdd6a4013
        Content-Length: 477
        Content-Type: multipart/form-data; boundary=------------------------4f51e636c0003d99

        --------------------------4f51e636c0003d99
        Content-Disposition: form-data; name="apiDefinition"

        {"paths":{"\/*":{"get":{"x-auth-type":"Application","x-throttling-policy":"Unlimited","responses":{"200":{"description":"OK"}}}}},"swagger":"2.0","info":{"title":"PhoneVerification","description":"Verify a phone number","contact":{"email":"xx@ee.com","name":"xx"},"version":"1.0.0"}}
        --------------------------4f51e636c0003d99--
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"paths\": {\"/*\": {\"get\":    {\n      \"x-auth-type\": \"Application\",\n      \"x-throttling-policy\": \"Unlimited\",\n      \"responses\": {\"200\": {\"description\": \"OK\"}}\n   }}},\n   \"swagger\": \"2.0\",\n   \"info\":    {\n      \"title\": \"PhoneVerification\",\n      \"description\": \"Verify a phone number\",\n      \"contact\":       {\n         \"email\": \"xx@ee.com\",\n         \"name\": \"xx\"\n      },\n      \"version\": \"1.0.0\"\n   }\n}"
      security:
        - OAuth2Security:
            - apim:api_create
      summary: Update swagger definition
      description: |
        This operation can be used to update the swagger definition of an existing API. Swagger definition to be updated is passed as a form data parameter `apiDefinition`.
      parameters:
        - $ref: '#/parameters/apiId'
        - in: formData
          name: apiDefinition
          description: Swagger definition of the API
          type: string
        - in: formData
          name: url
          description: Swagger definition URL of the API
          type: string
        - in: formData
          name: file
          description: Swagger definitio as a file
          type: file
          required: false
        - $ref: '#/parameters/If-Match'
      tags:
        - APIs
      responses:
        200:
          schema:
            type: string
            example: ""
          description: |
            OK.
            Successful response with updated Swagger definition
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        403:
          description: |
            Forbidden.
            The request must be conditional but no condition has been specified.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  ################################################################
  # The resource policy definitions of "Individual API" resource APIs
  ################################################################

  /apis/{apiId}/resource-policies:
    #-----------------------------------------------------
    # Retrieve the resource policy definition
    #-----------------------------------------------------
    get:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://localhost:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/resource-policies"
      x-wso2-request: |
        GET https://localhost:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/resource-policies
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\r\n    \"list\": [\r\n        {\r\n            \"id\": \"1990b54c-6685-4058-a08c-8fd5353056a6\",\r\n            \"httpVerb\": \"get\",\r\n            \"resourcePath\": \"checkPhoneNumbers\",\r\n            \"content\": \"<header description=\\\"SOAPAction\\\" name=\\\"SOAPAction\\\" scope=\\\"transport\\\" value=\\\"http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber\\\"/>\"\r\n        }\r\n    ],\r\n    \"count\": 1\r\n}"
      summary: Get the resource policy (inflow/outflow) definitions
      description: |
        This operation can be used to retrieve conversion policy resource definitions of an API.
      security:
        - OAuth2Security:
            - apim:api_view
      parameters:
        - $ref: '#/parameters/apiId'
        - in: query
          name: resourcePath
          description: Resource path of the resource policy definition
          type: string
          required: false
        - in: query
          name: verb
          description: HTTP verb of the resource path of the resource policy definition
          type: string
          required: false
        - in: query
          name: sequenceType
          description: sequence type of the resource policy resource definition
          type: string
          required: true
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Resource Policies
      responses:
        200:
          description: |
            OK.
            List of resource policy definitions of the API is returned
          schema:
            $ref: '#/definitions/ResourcePolicyList'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

  ################################################################
  # The "Individual Resource Policy" APIs
  ################################################################

  /apis/{apiId}/resource-policies/{resourcePolicyId}:
    #--------------------------------------------------------------------------
    # Retrieve the resource policy definition of a certain resource given by id
    #---------------------------------------------------------------------------
    get:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://localhost:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/resource-policies/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5"
      x-wso2-request: |
        GET https://localhost:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/resource-policies/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\r\n            \"id\": \"6c735e1d-8041-4f1e-b246-d28edaa650b0\",\r\n            \"httpVerb\": \"post\",\r\n            \"resourcePath\": \"checkPhoneNumbers\",\r\n            \"content\": \"<header description=\\\"SOAPAction\\\" name=\\\"SOAPAction\\\" scope=\\\"transport\\\" value=\\\"http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber\\\"/>\"\r\n}"
      summary: Get the resource policy (inflow/outflow) definition for a given resource identifier.
      description: |
        This operation can be used to retrieve conversion policy resource definitions of an API given the resource identifier.
      security:
        - OAuth2Security:
            - apim:api_view
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/resourcePolicyId'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Resource Policies
      responses:
        200:
          description: |
            OK.
            Requested resource policy definition of the API is returned for the given resource identifier.
          schema:
            $ref: '#/definitions/ResourcePolicyInfo'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #------------------------------------------------------------------------
    # Update the resource policy definition for the given resource identifier
    #------------------------------------------------------------------------
    put:
      consumes:
        - application/json
      security:
        - OAuth2Security:
            - apim:api_create
      x-wso2-curl: "curl -k -H \"Authorization:Bearer 5311eca3-8ac8-354e-ab36-7e2fdd6a4013\" -F apiDefinition=\"{\\\"paths\\\":{\\\"\\/*\\\":{\\\"get\\\":{\\\"x-auth-type\\\":\\\"Application\\\",\\\"x-throttling-tier\\\":\\\"Unlimited\\\",\\\"responses\\\":{\\\"200\\\":{\\\"description\\\":\\\"OK\\\"}}}}},\\\"x-wso2-security\\\":{\\\"apim\\\":{\\\"x-wso2-scopes\\\":[]}},\\\"swagger\\\":\\\"2.0\\\",\\\"info\\\":{\\\"title\\\":\\\"PhoneVerification\\\",\\\"description\\\":\\\"Verify a phone number\\\",\\\"contact\\\":{\\\"email\\\":\\\"xx@ee.com\\\",\\\"name\\\":\\\"xx\\\"},\\\"version\\\":\\\"1.0.0\\\"}}\" -X PUT \"https://localhost:9443/api/am/publisher/v1/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/resource-policies/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\""
      x-wso2-request: |
        PUT https://localhost:9443/api/am/publisher/v1/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/resource-policies/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5
        Authorization:Bearer 5311eca3-8ac8-354e-ab36-7e2fdd6a4013
        Content-Length: 477
        Content-Type: application/json; boundary=------------------------4f51e636c0003d99
        --------------------------4f51e636c0003d99
        { "content": "<header description=\"SOAPAction\" name=\"SOAPAction\" scope=\"transport\" value=\"http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber\"/>"}
        --------------------------4f51e636c0003d99--
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\r\n            \"id\": \"6c735e1d-8041-4f1e-b246-d28edaa650b0\",\r\n            \"httpVerb\": \"post\",\r\n            \"resourcePath\": \"checkPhoneNumbers\",\r\n            \"content\": \"<header description=\\\"SOAPAction\\\" name=\\\"SOAPAction\\\" scope=\\\"transport\\\" value=\\\"http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber\\\"/>\"\r\n}"
      summary: Update the resource policy(inflow/outflow) definition for the given resource identifier
      description: |
        This operation can be used to update the resource policy(inflow/outflow) definition for the given resource identifier of an existing API. resource policy definition to be updated is passed as a body parameter `content`.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/resourcePolicyId'
        - in: body
          name: body
          description: Content of the resource policy definition that needs to be updated
          schema:
            $ref: '#/definitions/ResourcePolicyInfo'
          required: true
        - $ref: '#/parameters/If-Match'
      tags:
        - API Resource Policies
      responses:
        200:
          description: |
            OK.
            Successful response with updated the resource policy definition
          schema:
            $ref: '#/definitions/ResourcePolicyInfo'
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        403:
          description: |
            Forbidden.
            The request must be conditional but no condition has been specified.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  ################################################################
  # The thumbnail resource of "Individual API" resource APIs
  ################################################################

  /apis/{apiId}/thumbnail:
    #-------------------------------------------------------------------------------------------------
    # Downloads a thumbnail image of an API
    #-------------------------------------------------------------------------------------------------
    get:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer d34baf74-3f02-3929-814e-88b27f750ba9\" https://127.0.0.1:9443/api/am/publisher/v1/apis/29c9ec3d-f590-467e-83e6-96d43517080f/thumbnail > image.jpg"
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/apis/29c9ec3d-f590-467e-83e6-96d43517080f/thumbnail
        Authorization: Bearer d34baf74-3f02-3929-814e-88b27f750ba9
      x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: image/jpeg\r\n\r\n[image content]"
      summary: Get thumbnail image
      description: |
        This operation can be used to download a thumbnail image of an API.
      security:
        - OAuth2Security:
            - apim:api_view
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - APIs
      responses:
        200:
          description: |
            OK.
            Thumbnail image returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested Document does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #----------------------------------------------------------------------------
    # Upload a thumbnail image to a certain API
    #----------------------------------------------------------------------------
    put:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
          - apim:api_create
          - apim:api_publish
      x-wso2-curl: "curl -X POST -H \"Authorization: Bearer d34baf74-3f02-3929-814e-88b27f750ba9\" https://127.0.0.1:9443/api/am/publisher/v1/apis/29c9ec3d-f590-467e-83e6-96d43517080f/thumbnail -F file=@image.jpg"
      x-wso2-request: |
        POST https://127.0.0.1:9443/api/am/publisher/v1/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/thumbnail
        Authorization: Bearer d34baf74-3f02-3929-814e-88b27f750ba9
        Content-Type: multipart/form-data; boundary=------------------------5e542e0e5b50e1e4
        Content-Length: 18333

        --------------------------5e542e0e5b50e1e4
        Content-Disposition: form-data; name="file"; filename="image.jpg"
        Content-Type: image/jpeg

        [image content]

        --------------------------5e542e0e5b50e1e4--
      x-wso2-response: "HTTP/1.1 201 Created\r\nLocation: https://127.0.0.1:9443/api/am/publisher/v1/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/thumbnail\r\nContent-Type: application/json\r\n\r\n{\r\n   \"relativePath\": \"/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/thumbnail\",\r\n   \"mediaType\": \"image/jpeg\"\r\n}"
      summary: Upload a thumbnail image
      operationId: updateAPIThumbnail
      description: |
        This operation can be used to upload a thumbnail image of an API. The thumbnail to be uploaded should be given as a form data parameter `file`.
      parameters:
        - $ref: '#/parameters/apiId'
        - in: formData
          name: file
          description: Image to upload
          type: file
          required: true
        - $ref: '#/parameters/If-Match'
      tags:
        - APIs
      responses:
        200:
          description: |
            OK.
            Image updated
          schema:
            $ref : '#/definitions/FileInfo'
          headers:
            Location:
              description: |
                The URL of the uploaded thumbnail image of the API.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'


######################################################
# The "API Throttling Policy" resource APIs
######################################################
  '/apis/{apiId}/subscription-policies':

#-----------------------------------------------------
# Retrieve subscription throttling policies of an API
#-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      x-wso2-curl: "curl \"https://localhost:9443/api/am/publisher/v1//apis/268c9e55-3dc1-4f47-82e7-977e5343d077/subscription-policies\""
      x-wso2-request: |
        GET https://localhost:9443/api/am/publisher/v1/apis/268c9e55-3dc1-4f47-82e7-977e5343d077/subscription-policies
      x-wso2-curl-tenant: "curl -k -H \"X-WSO2-Tenant:test.com\" https://localhost:9443/api/am/publisher/v1/apis/268c9e55-3dc1-4f47-82e7-977e5343d077/subscription-policies"
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n[{\n   \"unitTime\": 60000,\n   \"tierPlan\": \"FREE\",\n   \"stopOnQuotaReach\": true,\n   \"policyLevel\": \"api\",\n   \"requestCount\": 1,\n   \"description\": \"Allows 1 request(s) per minute.\",\n   \"name\": \"Bronze\",\n   \"attributes\": {}\n}]"
      summary: |
        Get details of the subscription throttling policies of an API
      description: |
        This operation can be used to retrieve details of the subscription throttling policy of an API by specifying the API Id.

        `X-WSO2-Tenant` header can be used to retrive API subscription throttling policies that belongs to a different tenant domain. If not specified super tenant will be used. If Authorization header is present in the request, the user's tenant associated with the access token will be used.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/requestedTenant'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - APIs
      responses:
        200:
          description: |
            OK.
            Throttling Policy returned
          schema:
            $ref: '#/definitions/ThrottlingPolicy'
          headers:
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests.
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests.
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource.
        404:
          description: |
            Not Found.
            Requested Throttling Policy does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported.
          schema:
            $ref: '#/definitions/Error'


######################################################
# The "Copy API" Processing Function resource API
######################################################
  /apis/copy-api:

#-----------------------------------------------------
# Create a new API based on an already existing one
#-----------------------------------------------------
    post:
      security:
        - OAuth2Security:
            - apim:api_create
      summary: Create a new API version
      description: |
        This operation can be used to create a new version of an existing API. The new version is specified as `newVersion` query parameter. New API will be in `CREATED` state.
      parameters:
        - name: newVersion
          description: Version of the new API.
          type: string
          in: query
          required: true
        - name: defaultVersion
          description: Specifies whether new API should be added as default version.
          type: boolean
          default: false
          in: query
        - $ref: '#/parameters/apiId-Q'
      x-examples:
        $ref: docs/examples/apis/apis_copyapi.yaml#/post
      tags:
        - APIs
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created API as entity in the body. Location header contains URL of newly created API.
          headers:
            Location:
              description: |
                The URL of the newly created API.
              type: string
          schema:
            $ref: '#/definitions/API'
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            API to copy does not exist.
          schema:
            $ref: '#/definitions/Error'

######################################################
# The "Change Lifecycle" Processing Function resource API
######################################################
  /apis/change-lifecycle:

#-----------------------------------------------------
# Change the lifecycle of an API
#-----------------------------------------------------
    post:
      security:
        - OAuth2Security:
          - apim:api_publish
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X POST \"https://127.0.0.1:9443/api/am/publisher/v1/apis/change-lifecycle?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b&action=Publish\""
      x-wso2-request: |
        POST https://127.0.0.1:9443/api/am/publisher/v1/apis/change-lifecycle?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b&action=Publish
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK"
      summary: Change API Status
      description: |
        This operation is used to change the lifecycle of an API. Eg: Publish an API which is in `CREATED` state. In order to change the lifecycle, we need to provide the lifecycle `action` as a query parameter.

        For example, to Publish an API, `action` should be `Publish`. Note that the `Re-publish` action is available only after calling `Block`.

        Some actions supports providing additional paramters which should be provided as `lifecycleChecklist` parameter. Please see parameters table for more information.
      parameters:
        - name: action
          description: |
            The action to demote or promote the state of the API.

            Supported actions are [ **Publish, Deploy as a Prototype, Demote to Created, Demote to Prototyped, Block, Deprecate, Re-Publish, Retire **]

          in: query
          type: string
          required: true
          enum:
            - Publish
            - Deploy as a Prototype
            - Demote to Created
            - Demote to Prototyped
            - Block
            - Deprecate
            - Re-Publish
            - Retire
        - name: lifecycleChecklist
          description: |

            Supported checklist items are as follows.
            1. **Deprecate Old Versions**: Setting this to true will deprecate older versions of a particular API when it is promoted to Published state from Created state.
            2. **Require Re-Subscription**: If you set this to true, users need to re subscribe to the API although they may have subscribed to an older version.

            You can specify additional checklist items by using an **"attribute:"** modifier.

            Eg: "Deprecate Old Versions:true" will deprecate older versions of a particular API when it is promoted to Published state from Created state. Multiple checklist items can be given in "attribute1:true, attribute2:false" format.

            **Sample CURL :**  curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" -X POST "https://localhost:9443/api/am/publisher/v1/apis/change-lifecycle?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b&action=Publish&lifecycleChecklist=Deprecate Old Versions:true,Require Re-Subscription:true"

          type: string
          in: query
        - $ref: '#/parameters/apiId-Q'
        - $ref: '#/parameters/If-Match'
      tags:
        - API Lifecycle
      responses:
        200:
          description: |
            OK.
            Lifecycle changed successfully.
          schema:
            $ref: '#/definitions/WorkflowResponse'
          headers:
            ETag:
              description: |
                Entity Tag of the changed API. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the API lifecycle has been modified the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        202:
          description: |
            Accepted.
            The request has been accepted.
          schema:
            $ref: '#/definitions/WorkflowResponse'
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        409:
          description: |
            Conflict.
            Pending workflow task exists.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'
######################################################
#  The "API State Change History"  resource API
######################################################
  /apis/{apiId}/lifecycle-history:

    #--------------------------------------------
    # Retrieve API LIfecycle change History
    #--------------------------------------------
    get:
      security:
        - OAuth2Security:
          - apim:api_publish
      x-wso2-curl: "curl -k -H \"Authorization: Bearer f8828f52-175a-4cb2-b246-02b1e6054f97\" https://127.0.0.1:9443/api/am/publisher/v1/apis/0527a55e-8dcf-4ce5-bddf-c77e8418be8a/lifecycle-history"
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/lifecycle-history
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\n Content-Type: application/json \n Content-Encoding: gzip \n Transfer-Encoding:
      chunked \n\n [ { \"postState\" : \"Created\",\n    \"updatedTime\" : \"Feb 23, 2017 5:17:02 PM\",\n\"user\" :
      \"admin\"\n  },\n { \"postState\" : \"Published\",\n    \"previousState\" : \"Created\",\n    \"updatedTime\" :
      \"Feb 23, 2017 5:17:17 PM\",\n    \"user\" : \"admin\"\n }\n]"
      summary: Get Lifecycle state change history of the API.
      description: |
        This operation can be used to retrieve Lifecycle state change history of the API.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Lifecycle
      responses:
        200:
          description: |
            OK.
            Lifecycle state change history returned successfully.
          schema:
            $ref: '#/definitions/LifecycleHistory'
          headers:
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
######################################################
#  The "API Lifecycle State Data"  resource API
######################################################
  /apis/{apiId}/lifecycle-state:

#--------------------------------------------
# Retrieve API LIfecycle state data
#--------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_publish
            - apim:api_create
      x-wso2-curl: "curl -k -H \"Authorization: Bearer f8828f52-175a-4cb2-b246-02b1e6054f97\" https://127.0.0.1:9443/api/am/publisher/v1/apis/0527a55e-8dcf-4ce5-bddf-c77e8418be8a/lifecycle"
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/lifecycle
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\n Content-Type: application/json \n Content-Encoding: gzip \n Transfer-Encoding:
      chunked \n\n {  \n   \"lcName\":\"API_LIFECYCLE\",\n   \"state\":\"Published\",\n   \"lifecycleId\":\"2febf145f07e457c9643100b6ec60679\",\n   \"checkItemBeanList\":[  \n\n   ],\n   \"inputBeanList\":[  \n\n   ],\n   \"customCodeBeanList\":[  \n      {  \n         \"classObject\":{  \n\n         },\n         \"targetName\":\"Maintenance\"\n      },\n      {  \n         \"classObject\":{  \n\n         },\n         \"targetName\":\"Deprecated\"\n      },\n      {  \n         \"classObject\":{  \n\n         },\n         \"targetName\":\"Created\"\n      },\n      {  \n         \"classObject\":{  \n\n         },\n         \"targetName\":\"Prototyped\"\n      }\n   ],\n   \"availableTransitionBeanList\":[  \n      {  \n         \"event\":\"Move to Maintenance\",\n         \"targetState\":\"Maintenance\"\n      },\n      {  \n         \"event\":\"Deploy as a Prototype\",\n         \"targetState\":\"Prototyped\"\n      },\n      {  \n         \"event\":\"Demote to Created\",\n         \"targetState\":\"Created\"\n      },\n      {  \n         \"event\":\"Deprecate\",\n         \"targetState\":\"Deprecated\"\n      },\n      {  \n         \"event\":\"Publish\",\n         \"targetState\":\"Published\"\n      }\n   ],\n   \"permissionBeanList\":[  \n\n   ]\n}"
      summary: Get Lifecycle state data of the API.
      description: |
        This operation can be used to retrieve Lifecycle state data of the API.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/If-None-Match'

      tags:
        - API Lifecycle
      responses:
        200:
          description: |
            OK.
            Lifecycle state data returned successfully.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
          schema:
            $ref: '#/definitions/LifecycleState'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

######################################################
#  The "API Lifecycle State Data"  resource API
######################################################
  /apis/{apiId}/lifecycle-state/pending-tasks:

#--------------------------------------------
# Delete API LIfecycle state change pending task
#--------------------------------------------
    delete:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer f8828f52-175a-4cb2-b246-02b1e6054f97\" -X DELETE https://127.0.0.1:9443/api/am/publisher/v1/apis/0527a55e-8dcf-4ce5-bddf-c77e8418be8a/lifecycle/lifecycle-pending-task"
      x-wso2-request: |
        DELETE https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/lifecycle/lifecycle-pending-task
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK"
      security:
        - OAuth2Security:
            - apim:api_publish
      summary: Delete pending lifecycle state change tasks.
      description: |
        This operation can be used to remove pending lifecycle state change requests that are in pending state
      parameters:
        - $ref: '#/parameters/apiId'
      tags:
        - API Lifecycle
      responses:
        200:
          description: |
            OK.
            Lifecycle state change pending task removed successfully.
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'


  ######################################################
  # The "Import API from OpenAPI Definition"  resource API
  ######################################################

  /apis/import-openapi:

    #----------------------------------------------------------------------------
    # Import API from API Definition
    #----------------------------------------------------------------------------
    post:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:api_create
      summary: Import an OpenAPI Definition
      description: |
        This operation can be used to create an API from an OpenAPI definition. Provide either `url` or `file`
        to specify the definition.

        Specify additionalProperties with **at least** API's name, version, context and endpointConfig.
      operationId: importOpenAPIDefinition
      parameters:
        - in: formData
          name: file
          description: Definition to upload as a file
          type: file
          required: false
        - in: formData
          name: url
          description: Definition url
          type: string
          required: false
        - in: formData
          name: additionalProperties
          description: Additional attributes specified as a stringified JSON with API's schema
          type: string
          required: false
      x-examples:
        $ref: docs/examples/apis/import_openapi_post.yaml
      tags:
        - APIs
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
            Location header contains URL of newly created entity.
          schema:
            $ref: '#/definitions/API'
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        415:
          description: |
            Unsupported Media Type.
            The entity of the request was in a not supported format.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Import API from a WSDL Definition"  resource API
  ######################################################

  /apis/import-wsdl:

    #----------------------------------------------------------------------------
    # Import API from a WSDL Definition
    #----------------------------------------------------------------------------
    post:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:api_create
      summary: Import a WSDL Definition
      operationId: importWSDLDefinition
      description: |
        This operation can be used to create an API using a WSDL definition. Provide either `url` or `file`
        to specify the definition.

        WSDL can be speficied as a single file or a ZIP archive with WSDLs and reference XSDs etc.
        Specify additionalProperties with **at least** API's name, version, context and endpointConfig.
      x-examples:
        $ref: docs/examples/apis/wsdl/import_wsdl_post.yaml
      parameters:
        - in: formData
          name: file
          description: WSDL definition as a file
          type: file
          required: false
        - in: formData
          name: url
          description: WSDL Definition url
          type: string
          required: false
        - in: formData
          name: additionalProperties
          description: Additional attributes specified as a stringified JSON with API's schema
          type: string
          required: false
        - in: formData
          name: implementationType
          type: string
          enum:
            - SOAPTOREST
            - SOAP
          default: SOAP
          description: |
            If 'SOAP' is specified, the API will be created with only one resource 'POST /*' which is to be used for SOAP
            operations.

            If 'HTTP_BINDING' is specified, the API will be created with resources using HTTP binding operations
            which are extracted from the WSDL.
          required: false
      tags:
        - APIs
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
            Location header contains URL of newly created entity.
          schema:
            $ref: '#/definitions/API'
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        415:
          description: |
            Unsupported Media Type.
            The entity of the request was in a not supported format.
          schema:
            $ref: '#/definitions/Error'


  ######################################################
  # The "Import GraphQL API Schema from API Definition"  resource API
  ######################################################

  /apis/import-graphql-schema:

    #----------------------------------------------------------------------------
    # Import API from API Definition
    #----------------------------------------------------------------------------
    post:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:api_create
      summary: Import API Definition
      description: |
        This operation can be used to create api from api definition.

        API definition is GraphQL Schema
      parameters:
        - in: formData
          name: type
          description: Definition type to upload
          type: string
          required: false
        - in: formData
          name: file
          description: Definition to uploads a file
          type: file
          required: false
        - in: formData
          name: additionalProperties
          description: Additional attributes specified as a stringified JSON with API's schema
          type: string
          required: false
        - $ref: '#/parameters/If-Match'
      tags:
        - APIs
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
            Location header contains URL of newly created entity.
          schema:
            $ref: '#/definitions/API'
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        415:
          description: |
            Unsupported Media Type.
            The entity of the request was in a not supported format.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Validate API Definition" utility API
  ######################################################

  /apis/validate-openapi:
    post:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:api_create
      summary: Validate an OpenAPI Definition
      operationId: validateOpenAPIDefinition
      description: |
        This operation can be used to validate an OpenAPI definition and retrieve a summary. Provide either `url`
        or `file` to specify the definition.
      parameters:
        - in: formData
          name: url
          description: OpenAPI definition url
          type: string
          required: false
        - in: formData
          name: file
          description: OpenAPI definition as a file
          type: file
          required: false
        - in: query
          name: returnContent
          description: |
            Specify whether to return the full content of the OpenAPI definition in the response. This is only
            applicable when using url based validation
          type: boolean
          default: false
          required: false
      tags:
        - Validation
      x-examples:
        $ref: docs/examples/apis/validate_openapi_post.yaml
      responses:
        200:
          description: |
            OK.
            API definition validation information is returned
          schema:
            $ref: '#/definitions/OpenAPIDefinitionValidationResponse'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Workflow for the given reference in not found.
          schema:
            $ref: '#/definitions/Error'

  /apis/validate-endpoint:
    post:
      security:
        - OAuth2Security:
            - apim:api_create
      summary: Check whether given endpoint url is valid
      operationId: validateEndpoint
      description: |
        Using this operation, it is possible check whether the given API endpoint url is a valid url
      parameters:
        - in: query
          name: endpointUrl
          description: API endpoint url
          type: string
          required: true
        - in: query
          name: apiId
          type: string
          required: false
      tags:
        - Validation
      responses:
        200:
          description: |
            OK.
            API definition validation information is returned
          schema:
            $ref: '#/definitions/ApiEndpointValidationResponse'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Workflow for the given reference in not found.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Validate API" utility API.
  # This api is used to check the existance of
  # apiName and context/version.
  ######################################################

  /apis/validate:
    post:
      x-examples:
        $ref: docs/examples/apis/apis_validate.yaml
      security:
        - OAuth2Security:
            - apim:api_create
      summary: Check given API attibute name is already exist.
      operationId: validateAPI
      description: |
        Using this operation, you can check a given API context is already used. You need to provide the context name you want to check.
      parameters:
        - in: query
          name: query
          description: |
            **Search condition**.

            You can search in attributes by using an **"<attribute>:"** modifier.

            Eg.
            "name:wso2" will match an API if the provider of the API is exactly "wso2".

            Supported attribute modifiers are [** version, context, name **]

            If no advanced attribute modifier has been specified, search will match the
            given query string against API Name.
          type: string
          required: true
        - $ref: "#/parameters/If-None-Match"
      tags:
        - Validation
      responses:
        200:
          description: |
            OK.
            API definition validation information is returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Workflow for the given reference in not found.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Validate WSDL Definition" utility API
  ######################################################

  /apis/validate-wsdl:
    post:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:api_create
      summary: Validate a WSDL Definition
      operationId: validateWSDLDefinition
      description: |
        This operation can be used to validate a WSDL definition and retrieve a summary. Provide either `url`
        or `file` to specify the definition.
      parameters:
        - in: formData
          name: url
          description: Definition url
          type: string
          required: false
        - in: formData
          name: file
          description: Definition to upload as a file
          type: file
          required: false
      tags:
        - Validation
      x-examples:
        $ref: docs/examples/apis/wsdl/validate_wsdl_post.yaml
      responses:
        200:
          description: |
            OK.
            API definition validation information is returned
          schema:
            $ref: '#/definitions/WSDLValidationResponse'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Workflow for the given reference in not found.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Validate GRAPH_QL API Definition" utility API
  ######################################################

  /apis/validate-graphql-schema:
    post:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:api_create
      summary: Validate GraphQL API definition and retrieve a summary
      description: |
        This operation can be used to validate a graphQL definition and retrieve a summary.
      parameters:
        - in: formData
          name: file
          description: Definition to upload as a file
          type: file
          required: true
      tags:
        - Validation
      responses:
        200:
          description: |
            OK.
            API definition validation information is returned
          schema:
            $ref: '#/definitions/GraphQLValidationResponse'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Workflow for the given reference in not found.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The GraphQL Schema Resource
  ######################################################

  /apis/{apiId}/graphql-schema:
    #-----------------------------------------------------
    # Retrieve the details about a certain GraphQL schema
    #-----------------------------------------------------
    get:
      x-scope: apim:api_view
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://localhost:9443/api/am/publisher/v1/apis/7f82f6b0-2667-441e-af23-c0fc44cf3a17/graphql-schema\""
      x-wso2-request: |
        GET https://localhost:9443/api/am/publisher/v1/apis/7f82f6b0-2667-441e-af23-c0fc44cf3a17/graphql-schema
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n{\r\n   \"name\": \"admin--hello1.0.0.graphql\",\r\n   \"schemaDefinition\": \"schema {\r\n  \r\n  # The query root of HackerNews GraphQL interface.\r\n  query: Query\r\n\r\n  # The root query for implementing GraphQL mutations.\r\n  mutation: Mutation\r\n}\r\n\r\ntype Link {\r\n\r\n  # ID of the link\r\n  id: ID!\r\n\r\n  # URL of the link\r\n  url: String!\r\n\r\n  # Description of the link\r\n  description: String\r\n}\r\n\r\ninput LinkFilter {\r\n\r\n  # Value to be checked whether it contains in the description\r\n  description_contains: String\r\n\r\n  # Value to be checked whether it contains in the URL\r\n  url_contains: String\r\n}\r\n\r\ntype Query {\r\n\r\n  # Fetches all the links\r\n  #\r\n  # Arguments\r\n  # filter: To filter the links according a specific criteria\r\n  # skip: Skip to a specific index in the list (default value is 0)\r\n  # first: Index of the link first to display (default value is 0)\r\n  allLinks(filter: LinkFilter, skip: Int = 0, first: Int = 0): [Link]\r\n}\r\n\r\ntype Mutation {\r\n\r\n  # Creates a new link\r\n  #\r\n  # Arguments\r\n  # url: URL of the link\r\n  # description: Description about the link\r\n  createLink(url: String!, description: String!): Link\r\n}\r\n\"\r\n}"
      summary: Get the Schema of a GraphQL API
      description: |
        This operation can be used to retrieve the Schema definition of a GraphQL API.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/Accept'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - GraphQL Schema (Individual)
      responses:
        200:
          description: |
            OK.
            Requested GraphQL Schema DTO object belongs to the API
          schema:
            $ref: '#/definitions/GraphQLSchema'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string

        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Add a GraphQL schema to the registry
    #-----------------------------------------------------
    put:
      x-scope: apim:api_create
      x-wso2-curl: "curl -k -H \"Authorization:Bearer 5311eca3-8ac8-354e-ab36-7e2fdd6a4013\" -H \"Content-Type: application/json\" -X POST -d @data.json \"https://localhost:9443/api/am/publisher/v1/apis/af3f96da-9ccf-463f-8cee-13ec8530a9cd/graphql-schema\""
      x-wso2-request: "PUT https://localhost:9443/api/am/publisher/v1/apis/af3f96da-9ccf-463f-8cee-13ec8530a9cd/graphql-schema\r\nContent-Type: text/plain\r\nAuthorization: Bearer 7d237cab-7011-3f81-b384-24d03e750873\r\n\r\n{\r\n   \"name\": \"admin--HackerNewsAPI1.0.0.graphql\",\r\n   \"schemaDefinition\": \"schema {\r\n  \r\n  # The query root of HackerNews GraphQL interface.\r\n  query: Query\r\n\r\n  # The root query for implementing GraphQL mutations.\r\n  mutation: Mutation\r\n}\r\n\r\ntype Link {\r\n\r\n  # ID of the link\r\n  id: ID!\r\n\r\n  # URL of the link\r\n  url: String!\r\n\r\n  # Description of the link\r\n  description: String\r\n}\r\n\r\ninput LinkFilter {\r\n\r\n  # Value to be checked whether it contains in the description\r\n  description_contains: String\r\n\r\n  # Value to be checked whether it contains in the URL\r\n  url_contains: String\r\n}\r\n\r\ntype Query {\r\n\r\n  # Fetches all the links\r\n  #\r\n  # Arguments\r\n  # filter: To filter the links according a specific criteria\r\n  # skip: Skip to a specific index in the list (default value is 0)\r\n  # first: Index of the link first to display (default value is 0)\r\n  allLinks(filter: LinkFilter, skip: Int = 0, first: Int = 0): [Link]\r\n}\r\n\r\ntype Mutation {\r\n\r\n  # Creates a new link\r\n  #\r\n  # Arguments\r\n  # url: URL of the link\r\n  # description: Description about the link\r\n  createLink(url: String!, description: String!): Link\r\n}\r\n\"\r\n}"
      x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n{\r\n   \"name\": \"admin--HackerNewsAPI1.0.0.graphql\",\r\n   \"schemaDefinition\": \"schema {\r\n  \r\n  # The query root of HackerNews GraphQL interface.\r\n  query: Query\r\n\r\n  # The root query for implementing GraphQL mutations.\r\n  mutation: Mutation\r\n}\r\n\r\ntype Link {\r\n\r\n  # ID of the link\r\n  id: ID!\r\n\r\n  # URL of the link\r\n  url: String!\r\n\r\n  # Description of the link\r\n  description: String\r\n}\r\n\r\ninput LinkFilter {\r\n\r\n  # Value to be checked whether it contains in the description\r\n  description_contains: String\r\n\r\n  # Value to be checked whether it contains in the URL\r\n  url_contains: String\r\n}\r\n\r\ntype Query {\r\n\r\n  # Fetches all the links\r\n  #\r\n  # Arguments\r\n  # filter: To filter the links according a specific criteria\r\n  # skip: Skip to a specific index in the list (default value is 0)\r\n  # first: Index of the link first to display (default value is 0)\r\n  allLinks(filter: LinkFilter, skip: Int = 0, first: Int = 0): [Link]\r\n}\r\n\r\ntype Mutation {\r\n\r\n  # Creates a new link\r\n  #\r\n  # Arguments\r\n  # url: URL of the link\r\n  # description: Description about the link\r\n  createLink(url: String!, description: String!): Link\r\n}\r\n\"\r\n}"
      summary: Add a Schema to a GraphQL API
      description: |
        This operation can be used to add a GraphQL Schema definition to an existing GraphQL API.
      parameters:
        - $ref: '#/parameters/apiId'
        - in: formData
          name: schemaDefinition
          description: schema definition of the GraphQL API
          type: string
          required: true
        - $ref: '#/parameters/If-Match'
      consumes:
        - multipart/form-data
      tags:
        - GraphQL Schema
      responses:
        200:
          description: |
            OK.
            Successful response with updated schema definition
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by cache, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        403:
          description: |
            Forbidden.
            The request must be conditional but no condition has been specified.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'


  #########################################################
  # The "Configure Monetization" Processing Function resource API
  #########################################################
  /apis/{apiId}/monetize:
    #---------------------------------------
    # Configure monetization for a given API
    #---------------------------------------
    post:
      security:
        - OAuth2Security:
            - apim:api_publish
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X POST -d @data.json \"https://127.0.0.1:9443/api/am/publisher/v1/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/monetize\""
      x-wso2-request: "POST https://127.0.0.1:9443/api/am/publisher/v1/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/monetize\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\nContent-Type: application/json\n{\r\n   \"enabled\":\"true\",\r\n   \"properties\":{\r\n      \"vendor\":\"test\",\r\n      \"type\":\"postpaid\"\r\n   }\r\n}"
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n{\r\n   \"enabled\":\"true\",\r\n   \"properties\":{\r\n      \"vendor\":\"test\",\r\n      \"type\":\"postpaid\"\r\n   }\r\n}"
      summary: Configure monetization for a given API
      description: |
        This operation can be used to configure monetization for a given API.
      parameters:
        - $ref: '#/parameters/apiId'
        - in: body
          name: body
          description: |
            Monetization data object
          required: true
          schema:
            $ref: '#/definitions/APIMonetizationInfo'
      tags:
        - API Monetization
      responses:
        201:
          description: |
            OK.
            Monetization status changed successfully.
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Requested resource does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

  #########################################################
  # The get monetizied policies processing function resource API
  #########################################################
  /apis/{apiId}/monetization:
    #---------------------------------------
    # Get monetized policies for a given API
    #---------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_publish
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" \"https://127.0.0.1:9443/api/am/publisher/v1/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/monetization\""
      x-wso2-request: "GET https://127.0.0.1:9443/api/am/publisher/v1/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/monetization\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\nContent-Type: application/json"
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n{\r\n   \"enabled\":\"true\",\r\n   \"monetizedTiers\":{\r\n      \"tier1\":\"enabled\",\r\n      \"tier2\":\"disabled\"\r\n   }\r\n}"
      summary: Get monetization status for each tier in a given API
      description: |
        This operation can be used to get monetization status for each tier in a given API
      parameters:
        - $ref: '#/parameters/apiId'
      tags:
        - API Monetization
      responses:
        200:
          description: |
            OK.
            Monetization status for each tier returned successfully.
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Requested resource does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Get Total Revenue" Processing Function resource API
  ######################################################
  /apis/{apiId}/revenue:
    get:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://127.0.0.1:9443/api/am/publisher/v1/apis/64eca60b-2e55-4c38-8603-e9e6bad7d809/revenue"
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/apis/64eca60b-2e55-4c38-8603-e9e6bad7d809/revenue
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"object\": \"invoice\",\n   \"account_country\": \"US\",\n   \"account_name\": \"test.com\",\n   \"amount_due\": \"0\",\n   \"amount_paid\": \"0\"\n  \"amount_remaining\": \"0\"\n}"
      security:
        - OAuth2Security:
            - apim:api_publish
      summary: Get total revenue details of a given monetized API with meterd billing.
      description: |
        This operation can be used to get details of total revenue details of a given monetized API with meterd billing.
      parameters:
        - $ref: '#/parameters/apiId'
      tags:
        - API Monetization
      responses:
        200:
          description: |
            OK.
            Details of a total revenue returned.
          schema:
            $ref: '#/definitions/APIRevenue'
          headers:
            Content-Type:
              description: The content type of the body.
              type: string
            ETag:
              description: 'Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).'
              type: string
            Last-Modified:
              description: 'Date and time the resource has been modified the last time. Used by caches, or in conditional requests (Will be supported in future).'
              type: string
        '304':
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        '404':
          description: |
            Not Found.
            Requested Subscription does not exist.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Document Collection" resource APIs
  ######################################################
  /apis/{apiId}/documents:

    #-----------------------------------------------------
    # Retrieve the documents associated with an API that qualify under a search condition
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents\""
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"previous\": \"\",\n   \"list\":    [\n            {\n         \"visibility\": \"API_LEVEL\",\n         \"sourceType\": \"INLINE\",\n         \"sourceUrl\": null,\n         \"otherTypeName\": null,\n         \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n         \"summary\": \"This is a sample documentation for v1\",\n         \"name\": \"PhoneVerification API Documentation\",\n         \"type\": \"HOWTO\"\n      },\n            {\n         \"visibility\": \"API_LEVEL\",\n         \"sourceType\": \"URL\",\n         \"sourceUrl\": \"http://wiki.cdyne.com/index.php/Phone_Verification\",\n         \"otherTypeName\": null,\n         \"documentId\": \"4145df31-04f1-440c-8d08-68952874622c\",\n         \"summary\": \"This is the URL for online documentation\",\n         \"name\": \"Online Documentation\",\n         \"type\": \"SAMPLES\"\n      }\n   ],\n   \"next\": \"\",\n   \"count\": 2\n}"
      summary: Get a list of documents of an API
      description: |
        This operation can be used to retrieve a list of documents belonging to an API by providing the id of the API.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/limit'
        - $ref: '#/parameters/offset'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Documents
      responses:
        200:
          description: |
            OK.
            Document list is returned.
          schema:
            $ref: '#/definitions/DocumentList'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Add a document to a certain API
    #-----------------------------------------------------
    post:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X POST -d @data.json \"https://127.0.0.1:9443/api/am/publisher/v1/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents\""
      x-wso2-request: "POST https://127.0.0.1:9443/api/am/publisher/v1/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\nContent-Type: application/json\n\n{\n    \"visibility\": \"API_LEVEL\",\n    \"sourceType\": \"INLINE\",\n    \"sourceUrl\": null,\n    \"otherTypeName\": null,\n    \"summary\": \"This is a sample documentation\",\n    \"name\": \"Introduction to PhoneVerification API\",\n    \"type\": \"HOWTO\"\n}"
      x-wso2-response: "HTTP/1.1 201 Created\nLocation: https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058\nContent-Type: application/json\n\n{\n   \"visibility\": \"API_LEVEL\",\n   \"sourceType\": \"INLINE\",\n   \"sourceUrl\": null,\n   \"otherTypeName\": null,\n   \"documentId\": \"ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058\",\n   \"summary\": \"This is a sample documentation\",\n   \"name\": \"Introduction to PhoneVerification API\",\n   \"type\": \"HOWTO\"\n}"
      security:
        - OAuth2Security:
            - apim:document_create
      summary: Add a new document to an API
      description: |
        This operation can be used to add a new documentation to an API. This operation only adds the metadata of a document. To add the actual content we need to use **Upload the content of an API document ** API once we obtain a document Id by this operation.
      parameters:
        - $ref: '#/parameters/apiId'
        - in: body
          name: body
          description: |
            Document object that needs to be added
          required: true
          schema:
            $ref: '#/definitions/Document'
        - $ref: '#/parameters/If-Match'
      tags:
        - API Documents
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created Document object as entity in the body.
            Location header contains URL of newly added document.
          schema:
            $ref: '#/definitions/Document'
          headers:
            Location:
              description: |
                Location to the newly created Document.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        415:
          description: |
            Unsupported media type.
            The entity of the request was in a not supported format.

  ######################################################
  # The "Individual Document" resource APIs
  ######################################################
  '/apis/{apiId}/documents/{documentId}':

    #-----------------------------------------------------
    # Retrieve a particular document of a certain API
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\""
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"visibility\": \"API_LEVEL\",\n   \"sourceType\": \"INLINE\",\n   \"sourceUrl\": null,\n   \"otherTypeName\": null,\n   \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n   \"summary\": \"This is a sample documentation\",\n   \"name\": \"PhoneVerification API Documentation\",\n   \"type\": \"HOWTO\"\n}"
      summary: Get a document of an API
      description: |
        This operation can be used to retrieve a particular document's metadata associated with an API.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/documentId'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Documents
      responses:
        200:
          description: |
            OK.
            Document returned.
          schema:
            $ref: '#/definitions/Document'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested Document does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Update a particular document of a certain API
    #-----------------------------------------------------
    put:
      x-wso2-curl: "curl -k -H \"Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a\" -H \"Content-Type: application/json\" -X PUT -d data.json \"https://127.0.0.1:9443/api/am/publisher/v1/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\""
      x-wso2-request: "PUT https://127.0.0.1:9443/api/am/publisher/v1/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\nAuthorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a\nContent-Type: application/json\n\n{\n   \"visibility\": \"API_LEVEL\",\n   \"sourceType\": \"INLINE\",\n   \"sourceUrl\": null,\n   \"otherTypeName\": null,\n   \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n   \"summary\": \"This is a sample documentation for v1\",\n   \"name\": \"PhoneVerification API Documentation\",\n   \"type\": \"HOWTO\"\n}"
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"visibility\": \"API_LEVEL\",\n   \"sourceType\": \"INLINE\",\n   \"sourceUrl\": null,\n   \"otherTypeName\": null,\n   \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n   \"summary\": \"This is a sample documentation for v1\",\n   \"name\": \"PhoneVerification API Documentation\",\n   \"type\": \"HOWTO\"\n}"
      security:
        - OAuth2Security:
            - apim:document_manage
      summary: Update a document of an API
      description: |
        This operation can be used to update metadata of an API's document.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/documentId'
        - in: body
          name: body
          description: |
            Document object that needs to be added
          required: true
          schema:
            $ref: '#/definitions/Document'
        - $ref: '#/parameters/If-Match'
      tags:
        - API Documents
      responses:
        200:
          description: |
            OK.
            Document updated
          schema:
            $ref: '#/definitions/Document'
          headers:
            Location:
              description: |
                The URL of the updated document.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Delete a particular document of a certain API
    #-----------------------------------------------------
    delete:
      security:
        - OAuth2Security:
            - apim:document_manage
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X DELETE https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058"
      x-wso2-request: |
        DELETE https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK"
      summary: Delete a document of an API
      description: |
        This operation can be used to delete a document associated with an API.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/documentId'
        - $ref: '#/parameters/If-Match'
      tags:
        - API Documents
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
        404:
          description: |
            Not Found.
            Resource to be deleted does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  ################################################################
  # The content resource of "Individual Document" resource APIs
  ################################################################

  '/apis/{apiId}/documents/{documentId}/content':

    #-------------------------------------------------------------------------------------------------
    # Downloads a FILE type document/get the inline content or source url of a certain document
    #-------------------------------------------------------------------------------------------------
    get:
      produces:
        - application/octet-stream
      security:
        - OAuth2Security:
            - apim:api_view
      x-wso2-curl: "curl -k -H \"Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a\" \"https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content\" > sample.pdf"
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content
        Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Disposition: attachment; filename=\"sample.pdf\"\nContent-Type: application/octet-stream\nContent-Length: 7802\n\n%PDF-1.4\n%äüöß\n2 0 obj\n<</Length 3 0 R/Filter/FlateDecode>>\nstream\n..\n>>\nstartxref\n7279\n%%EOF"
      summary: Get the content of an API document
      description: |
        This operation can be used to retrive the content of an API's document.

        The document can be of 3 types. In each cases responses are different.

        1. **Inline type**:
           The content of the document will be retrieved in `text/plain` content type

           _Sample cURL_ : `curl -k -H "Authorization:Bearer 579f0af4-37be-35c7-81a4-f1f1e9ee7c51" -F inlineContent=@"docs.txt" -X POST "https://localhost:9443/api/am/publisher/v1/apis/995a4972-3178-4b17-a374-756e0e19127c/documents/43c2bcce-60e7-405f-bc36-e39c0c5e189e/content`
        2. **FILE type**:
           The file will be downloaded with the related content type (eg. `application/pdf`)
        3. **URL type**:
            The client will recieve the URL of the document as the Location header with the response with - `303 See Other`
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/documentId'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Documents
      responses:
        200:
          description: |
            OK.
            File or inline content returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        303:
          description: |
            See Other.
            Source can be retrived from the URL specified at the Location header.
          headers:
            Location:
              description: |
                The Source URL of the document.
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested Document does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #----------------------------------------------------------------------------
    # Upload a file or add inline content to a document of a certain API
    #----------------------------------------------------------------------------
    post:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:document_create
      x-wso2-curl: "curl -k -H \"Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -F file=@\"sample.pdf\" -X POST \"https://127.0.0.1:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content\""
      x-wso2-request: |
        POST https://127.0.0.1:9443/api/am/publisher/v1/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/documents/b3a79270-02bb-4e39-9ac1-90ce8f6c84af/content
        Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
        Content-Length: 8004
        Content-Type: multipart/form-data; boundary=------------------------7b9a53f1ffa452b9

        --------------------------7b9a53f1ffa452b9
        Content-Disposition: form-data; name="file"; filename="sample.pdf"
        Content-Type: application/octet-stream

        [file content]

        --------------------------7b9a53f1ffa452b9--
      x-wso2-response: "HTTP/1.1 201 Created\nLocation: https://127.0.0.1:9443/api/am/publisher/v1/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/documents/b3a79270-02bb-4e39-9ac1-90ce8f6c84af/content\nContent-Type: application/json\n\n{\n    \"visibility\":\"API_LEVEL\",\n    \"sourceType\":\"FILE\",\n    \"sourceUrl\":null,\n    \"otherTypeName\":null,\n    \"documentId\":\"daf732d3-bda2-46da-b381-2c39d901ea61\",\n    \"summary\":\"This is a sample documentation pdf\",\n    \"name\":\"Introduction to PhoneVerification API PDF\",\n    \"type\":\"HOWTO\"\n}"
      summary: Upload the content of an API document
      description: |
        Thid operation can be used to upload a file or add inline content to an API document.

        **IMPORTANT:**
        * Either **file** or **inlineContent** form data parameters should be specified at one time.
        * Document's source type should be **FILE** in order to upload a file to the document using **file** parameter.
        * Document's source type should be **INLINE** in order to add inline content to the document using **inlineContent** parameter.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/documentId'
        - in: formData
          name: file
          description: Document to upload
          type: file
          required: false
        - in: formData
          name: inlineContent
          description: Inline content of the document
          type: string
          required: false
        - $ref: '#/parameters/If-Match'
      tags:
        - API Documents
      responses:
        200:
          description: |
            OK.
            Document updated
          schema:
            $ref: '#/definitions/Document'
          headers:
            Location:
              description: |
                The URL of the updated content of the document.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  #----------------------------------------------------------------------------
  # API Document Name validation method.
  #----------------------------------------------------------------------------
  /apis/{apiId}/documents/validate:
    post:
      x-examples:
        $ref: docs/examples/apis/apis_id_document_validate.yaml
      security:
        - OAuth2Security:
            - apim:document_create
      summary: Check whether a document with the provided name exist.
      description: |
        This operation can be used to verify the document name exists or not.
      operationId: validateDocument
      parameters:
        - $ref: '#/parameters/apiId'
        - in: query
          name: name
          description: |
            The name of the document which needs to be checked for the existance.
          required: true
          type: string
        - $ref: '#/parameters/If-Match'
      tags:
        - API Documents
      responses:
        200:
          description: |
            OK.
            Successful response if the api name exist.
          schema:
            $ref: '#/definitions/Document'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Requested document not found.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "specific mediation policy" resource APIs
  ######################################################
  '/apis/{apiId}/mediation-policies':

    #-----------------------------------------------------------------------------------------
    # Retrieving the list of all API specific mediation sequences under a given search condition
    #-----------------------------------------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:mediation_policy_view
      x-examples:
        $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_get.yaml
      summary: |
        Get all mediation policies of an API
      operationId:  apisApiIdMediationPoliciesGet
      description: |
        This operation provides you a list of available mediation policies of an API.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref : '#/parameters/limit'
        - $ref : '#/parameters/offset'
        - name : query
          in: query
          description: "-Not supported yet-"
          type: string
        - $ref : "#/parameters/If-None-Match"
      tags:
        - API Mediation Policies
      responses:
        200:
          description: |
            OK.
            List of qualifying APIs is returned.
          schema:
            $ref: '#/definitions/MediationList'
          headers:
            Content-Type:
              description: The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #----------------------------------------------------------------------------
    # Upload an API specific mediation policy
    #----------------------------------------------------------------------------
    post:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:mediation_policy_create
      x-examples:
        $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_post.yaml
      summary: Add an API specific mediation policy
      operationId: apisApiIdMediationPoliciesPost
      description: |
        This operation can be used to add an API specifc mediation policy.
      parameters:
        - in: formData
          name: mediationPolicyFile
          description: Mediation Policy to upload
          type: file
          required: false
        - in: formData
          name: inlineContent
          description: Inline content of the Mediation Policy
          type: string
          required: false
        - in: formData
          name: type
          description: Type of the mediation sequence
          required: true
          type: string
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/If-Match'
      tags:
        - API Mediation Policies
      responses:
        201:
          description: |
            OK.
            mediation policy uploaded
          schema:
            $ref : '#/definitions/Mediation'
          headers:
            Location:
              description: |
                The URL of the uploaded mediation policy of the API.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Individual API specific mediation sequence" resource
  ######################################################
  /apis/{apiId}/mediation-policies/{mediationPolicyId}:

    #-----------------------------------------------------
    # Retrieve a particular API specific mediation sequence
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      x-examples:
        $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_id_get.yaml
      summary: Get an API specific mediation policy
      operationId:  apisApiIdMediationPoliciesMediationPolicyIdGet
      description: |
        This operation can be used to retrieve a particular API specific mediation policy.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/mediationPolicyId'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Mediation Policy
      responses:
        200:
          description: |
            OK.
            Mediation policy returned.
          schema:
            $ref: '#/definitions/Mediation'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested Document does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Delete the mediation policy
    #-----------------------------------------------------
    delete:
      security:
        - OAuth2Security:
            - apim:mediation_policy_manage
      x-examples:
        $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_id_delete.yaml
      summary: Delete an API specific mediation policy
      operationId:  apisApiIdMediationPoliciesMediationPolicyIdDelete
      description: |
        This operation can be used to delete an existing API specific mediation policy providing the Id of the API and the Id of the mediation policy.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/mediationPolicyId'
        - $ref: '#/parameters/If-Match'
      tags:
        - API Mediation Policy
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
        403:
          description: |
            Forbidden.
            The request must be conditional but no condition has been specified.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Resource to be deleted does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'
  ###################################################################
  # The "Individual API specific mediation sequence content" resource
  ###################################################################
  /apis/{apiId}/mediation-policies/{mediationPolicyId}/content:

    #---------------------------------------------------------------
    # Retrieve a particular API specific mediation sequence content
    #---------------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      x-examples:
        $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_id_content_get.yaml
      summary: Download an API specific mediation policy
      operationId:  apisApiIdMediationPoliciesMediationPolicyIdContentGet
      description: |
        This operation can be used to download a particular API specific mediation policy.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/mediationPolicyId'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Mediation Policy
      responses:
        200:
          description: |
            OK.
            Mediation policy returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested file does not exist.
          schema:
            $ref: '#/definitions/Error'
    #-----------------------------------------------------
    # Update a mediation policy
    #-----------------------------------------------------
    put:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:mediation_policy_manage
      x-examples:
        $ref: docs/examples/mediation-policies/apis_id_mediationpolicies_id_content_put.yaml
      summary: Update an API specific mediation policy
      operationId:  apisApiIdMediationPoliciesMediationPolicyIdContentPut
      description: |
        This operation can be used to update an existing mediation policy of an API.
      parameters:
        - in: formData
          name: file
          description: Mediation Policy to upload
          type: file
          required: false
        - in: formData
          name: inlineContent
          description: Inline content of the Mediation Policy
          type: string
          required: false
        - in: formData
          name: type
          description: Type of the mediation sequence(in/out/fault)
          required: true
          type: string
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/mediationPolicyId'
        - $ref: '#/parameters/If-Match'
      tags:
        - API Mediation Policy
      responses:
        200:
          description: |
            OK.
            Successful response with updated API object
          schema:
            $ref: '#/definitions/Mediation'
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        403:
          description: |
            Forbidden.
            The request must be conditional but no condition has been specified.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  ################################################################
  # The WSDL resource of "Individual API" resource APIs
  ################################################################

  /apis/{apiId}/wsdl:
    #-----------------------------------------------------
    # Retrieve the API's WSDL
    #-----------------------------------------------------
    get:
      produces:
        - application/json
        - application/wsdl
        - application/zip
      security:
        - OAuth2Security:
            - apim:api_view
      operationId: getWSDLOfAPI
      summary: Get WSDL definition
      description: |
        This operation can be used to retrieve the WSDL definition of an API. It can be either a single WSDL file or a WSDL archive.

        The type of the WSDL of the API is indicated at the "wsdlInfo" element of the API payload definition.
      x-examples:
        $ref: docs/examples/apis/wsdl/apiId_wsdl_get.yaml
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - APIs
      responses:
        200:
          description: |
            OK.
            Requested WSDL document of the API is returned
          headers:
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Update the API's WSDL
    #-----------------------------------------------------
    put:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:api_create
      operationId: updateWSDLOfAPI
      summary: Update WSDL definition
      description: |
        This operation can be used to update the WSDL definition of an existing API. WSDL to be updated can be passed as either "url" or "file".
        Only one of "url" or "file" can be used at the same time. "file" can be specified as a single WSDL file or as a zip file which has a WSDL
        and its dependencies (eg: XSDs)
      x-examples:
        $ref: docs/examples/apis/wsdl/apiId_wsdl_put.yaml
      parameters:
        - $ref: '#/parameters/apiId'
        - in: formData
          name: file
          description: WSDL file or archive to upload
          type: file
          required: true
        - in: formData
          name: url
          description: WSDL Definition url
          type: string
          required: false
        - $ref: '#/parameters/If-Match'
      tags:
        - APIs
      responses:
        200:
          description: |
            OK.
            Successful response with updated WSDL definition
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        403:
          description: |
            Forbidden.
            The request must be conditional but no condition has been specified.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # Check scope existence
  ######################################################
  /scopes/{name}:
    #-----------------------------------------------------
    # The scope name existence check resource
    #-----------------------------------------------------
    head:
      security:
        - OAuth2Security:
            - apim:api_create
            - apim:api_publish
      operationId: validateScope
      summary:
        Check given scope name is already exist
      description: |
        Using this operation, user can check a given scope name exists or not.
      parameters:
        - $ref : '#/parameters/scopeName'
      tags:
        - scope
      responses:
        200:
          description:
            OK.
            Requested scope name exists.
        404:
          description:
            Not Found.
            Requested scope name does not exist.

  ######################################################
  # The "Resource Paths" resource
  ######################################################
  /apis/{apiId}/resource-paths:

    #-----------------------------------------------------
    # Retrieve a particular API specific Resource Paths
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      x-wso2-curl: "curl -k -H \"Authorization: Bearer 5aa0acc0-0ce3-3a0b-8cc8-db5ef696ee23\" https://localhost:9443/api/am/publisher/v1/apis/40082986-6488-4b86-801a-b0b069d4588c/resource-paths"
      x-wso2-request: "GET https://localhost:9443/api/am/publisher/v1/apis/40082986-6488-4b86-801a-b0b069d4588c/resource-paths\r\nAuthorization: Bearer 5aa0acc0-0ce3-3a0b-8cc8-db5ef696ee23"
      x-wso2-response: ""
      summary: Get Resource Paths of an API
      description: |
        This operation can be used to retrieve resource paths defined for a specific api.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/limit'
        - $ref: '#/parameters/offset'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - APIs
      responses:
        200:
          description: |
            OK.
            ResourcePaths returned.
          schema:
            $ref: '#/definitions/ResourcePathList'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested Document does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The Security Audit API List
  ######################################################
  /apis/{apiId}/auditapi:
    #-----------------------------------------------------
    # Retrieve the Security Audit Report of the Audit API
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      x-examples:
        $ref: "docs/examples/apis/apis_id_auditapi_get.yaml"
      summary: Retrieve the Security Audit Report of the Audit API
      description: |
        Retrieve the Security Audit Report of the Audit API
      parameters:
        - $ref: "#/parameters/Accept"
        - $ref: "#/parameters/apiId"
      tags:
        - API Audit
      responses:
        200:
          description: |
            OK.
            The Security Audit Report has been returned.
          headers:
            Content-Type:
              description: |
                The content of the body.
              default: application/json
              type: string
          schema:
            $ref: '#/definitions/AuditReport'
        404:
          description: |
            Not Found.
            The Security Audit Report was not found.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "ExternalStore Collection" resource APIs
  ######################################################
  /apis/{apiId}/external-stores:

    #-------------------------------------------------------------
    # Retrieve the published external stores list of a certain API
    #-------------------------------------------------------------
    get:
      operationId: getAllPublishedExternalStoresByAPI
      security:
        - OAuth2Security:
            - apim:api_view
      x-examples:
        $ref: docs/examples/external-stores/external_stores.yaml#/getPublishedExternalStoresByAPI
      summary: Get the list of external stores which an API is published to
      description: |
        This operation can be used to retrieve a list of external stores which an API is published to by providing the id of the API.
      parameters:
        - $ref: '#/parameters/apiId'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - External Stores
      responses:
        200:
          description: |
            OK.
            External Store list is returned.
          schema:
            $ref: '#/definitions/APIExternalStoreList'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        500:
          description: Internal server error while getting external stores of the API.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Publish to External Stores" resource APIs
  ######################################################
  /apis/{apiId}/publish-to-external-stores:

    #-----------------------------------------------------
    # Publish an API to external stores
    #-----------------------------------------------------
    post:
      operationId: publishAPIToExternalStores
      security:
        - OAuth2Security:
            - apim:api_publish
      x-examples:
        $ref: docs/examples/external-stores/external_stores.yaml#/publishToExternalStore
      summary: Publish an API to external stores
      description: |
        This operation can be used to publish an API to a list of external stores.
      parameters:
        - $ref: '#/parameters/apiId'
        - name: externalStoreIds
          type: string
          description: External Store Ids of stores which the API needs to be published or updated.
          in: query
          required: true
        - $ref: '#/parameters/If-Match'
      tags:
        - External Stores
      responses:
        200:
          description: |
            OK.
            API was successfully published to all the selected external stores.
          schema:
            $ref: '#/definitions/APIExternalStoreList'
          headers:
            ETag:
              description: |
                Entity Tag of the blocked subscription.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the subscription has been blocked.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        500:
          description: Internal server error while publishing to external stores
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Request API resource or external store Ids not found.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Subscription Collection" resource APIs
  ######################################################
  /subscriptions:

    #-----------------------------------------------------
    # Retrieve all subscriptions of a certain API
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:subscription_view
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://127.0.0.1:9443/api/am/publisher/v1/subscriptions?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b\""
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/subscriptions?apiId=890a4f4d-09eb-4877-a323-57f6ce2ed79b
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n \n{\n   \"previous\": \"\",\n   \"list\":    [\n            {\n         \"subscriptionId\": \"64eca60b-2e55-4c38-8603-e9e6bad7d809\",\n         \"policy\": \"Gold\",\n         \"apiIdentifier\": \"admin-PhoneVerification-1.0.0\",\n         \"applicationId\": \"896658a0-b4ee-4535-bbfa-806c894a4015\",\n         \"lifeCycleStatus\": \"UNBLOCKED\"\n      },\n            {\n         \"subscriptionId\": \"7ac22c34-8745-4cfe-91e0-262c50b2f2e3\",\n         \"policy\": \"Gold\",\n         \"apiIdentifier\": \"admin-PhoneVerification-1.0.0\",\n         \"applicationId\": \"367a2361-8db5-4140-8133-c6c8dc7fa0c4\",\n         \"lifeCycleStatus\": \"UNBLOCKED\"\n      }\n   ],\n   \"next\": \"\",\n   \"count\": 2\n}"
      summary: Get all Subscriptions
      description: |
        This operation can be used to retrieve a list of subscriptions of the user associated with the provided access token. This operation is capable of

        1. Retrieving all subscriptions for the user's APIs.
        `GET https://127.0.0.1:9443/api/am/publisher/v1/subscriptions`

        2. Retrieving subscriptions for a specific API.
        `GET https://127.0.0.1:9443/api/am/publisher/v1/subscriptions?apiId=c43a325c-260b-4302-81cb-768eafaa3aed`
      parameters:
        - $ref: '#/parameters/apiId-Q'
        - $ref: '#/parameters/limit'
        - $ref: '#/parameters/offset'
        - $ref: '#/parameters/If-None-Match'
        - name : query
          in: query
          description: |
            Keywords to filter subscriptions
          type: string
      tags:
        - Subscriptions
      responses:
        200:
          description: |
            OK.
            Subscription list returned.
          schema:
            $ref: '#/definitions/SubscriptionList'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        406:
          description: |
            Not Acceptable. The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The get usage billing resource APIs
  ######################################################
  '/subscriptions/{subscriptionId}/usage':
    get:
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://127.0.0.1:9443/api/am/publisher/v1/subscriptions/64eca60b-2e55-4c38-8603-e9e6bad7d809/usage"
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/subscriptions/64eca60b-2e55-4c38-8603-e9e6bad7d809/usage
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"object\": \"invoice\",\n   \"account_country\": \"US\",\n   \"account_name\": \"test.com\",\n   \"amount_due\": \"0\",\n   \"amount_paid\": \"0\"\n  \"amount_remaining\": \"0\"\n}"
      security:
        - OAuth2Security:
            - apim:subscription_view
      summary: Get details of a pending invoice for a monetized subscription with meterd billing.
      description: |
        This operation can be used to get details of a pending invoice for a monetized subscription with meterd billing.
      parameters:
        - $ref: '#/parameters/subscriptionId'
      tags:
        - API Monetization
      responses:
        200:
          description: |
            OK.
            Details of a pending invoice returned.
          schema:
            $ref: '#/definitions/APIMonetizationUsage'
          headers:
            Content-Type:
              description: The content type of the body.
              type: string
            ETag:
              description: 'Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).'
              type: string
            Last-Modified:
              description: 'Date and time the resource has been modified the last time. Used by caches, or in conditional requests (Will be supported in future).'
              type: string
        '304':
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        '404':
          description: |
            Not Found.
            Requested Subscription does not exist.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Block Subscription" Processing Function resource API
  ######################################################
  /subscriptions/block-subscription:

    #-----------------------------------------------------
    # Block a certain subscription
    #-----------------------------------------------------
    post:
      security:
        - OAuth2Security:
            - apim:subscription_block
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X POST \"https://127.0.0.1:9443/api/am/publisher/v1/subscriptions/block-subscription?subscriptionId=64eca60b-2e55-4c38-8603-e9e6bad7d809&blockState=PROD_ONLY_BLOCKED\""
      x-wso2-request: |
        POST https://127.0.0.1:9443/api/am/publisher/v1/subscriptions/block-subscription?subscriptionId=64eca60b-2e55-4c38-8603-e9e6bad7d809&blockState=PROD_ONLY_BLOCKED
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n \n{\n   \"subscriptionId\": \"64eca60b-2e55-4c38-8603-e9e6bad7d809\",\n   \"policy\": \"Gold\",\n   \"apiIdentifier\": \"admin-PhoneVerification-1.0.0\",\n   \"applicationId\": \"896658a0-b4ee-4535-bbfa-806c894a4015\",\n   \"lifeCycleStatus\": \"PROD_ONLY_BLOCKED\"\n}"
      summary: Block a subscription
      description: |
        This operation can be used to block a subscription. Along with the request, `blockState` must be specified as a query parameter.

        1. `BLOCKED` : Subscription is completely blocked for both Production and Sandbox environments.
        2. `PROD_ONLY_BLOCKED` : Subscription is blocked for Production environment only.
      parameters:
        - $ref: '#/parameters/subscriptionId-Q'
        - name: blockState
          in: query
          description: |
            Subscription block state.
          type: string
          required: true
          enum:
            - BLOCKED
            - PROD_ONLY_BLOCKED
        - $ref: '#/parameters/If-Match'
      tags:
        - Subscriptions
      responses:
        200:
          description: |
            OK.
            Subscription was blocked successfully.
          headers:
            ETag:
              description: |
                Entity Tag of the blocked subscription.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the subscription has been blocked.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Requested subscription does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Unblock Subscription" Processing Function resource API
  ######################################################
  /subscriptions/unblock-subscription:

    #-----------------------------------------------------
    # Unblock a certain subscription
    #-----------------------------------------------------
    post:
      security:
        - OAuth2Security:
            - apim:subscription_block
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X POST \"https://127.0.0.1:9443/api/am/publisher/v1/subscriptions/unblock-subscription?subscriptionId=64eca60b-2e55-4c38-8603-e9e6bad7d809\""
      x-wso2-request: |
        POST https://127.0.0.1:9443/api/am/publisher/v1/subscriptions/unblock-subscription?subscriptionId=64eca60b-2e55-4c38-8603-e9e6bad7d809
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8`
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"subscriptionId\": \"64eca60b-2e55-4c38-8603-e9e6bad7d809\",\n   \"policy\": \"Gold\",\n   \"apiIdentifier\": \"admin-PhoneVerification-1.0.0\",\n   \"applicationId\": \"896658a0-b4ee-4535-bbfa-806c894a4015\",\n   \"lifeCycleStatus\": \"UNBLOCKED\"\n} "
      summary: Unblock a Subscription
      parameters:
        - $ref: '#/parameters/subscriptionId-Q'
        - $ref: '#/parameters/If-Match'
      description: |
        This operation can be used to unblock a subscription specifying the subscription Id. The subscription will be fully unblocked after performing this operation.
      tags:
        - Subscriptions
      responses:
        200:
          description: |
            OK.
            Subscription was unblocked successfully.
          headers:
            ETag:
              description: |
                Entity Tag of the unblocked subscription.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the subscription has been unblocked.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Requested subscription does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Tier Collection" resource APIs
  ######################################################
  '/throttling-policies/{policyLevel}':

    #-----------------------------------------------------
    # Retrieve the list of all available policies
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://127.0.0.1:9443/api/am/publisher/v1/policies/api"
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/policies/api
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n\n{\n   \"previous\": \"\",\n   \"list\":    [\n            {\n         \"unitTime\": 60000,\n         \"tierPlan\": \"FREE\",\n         \"tierLevel\": \"api\",\n         \"stopOnQuotaReach\": true,\n         \"requestCount\": 1,\n         \"description\": \"Allows 1 request(s) per minute.\",\n         \"name\": \"Bronze\",\n         \"attributes\": {}\n      },\n            {\n         \"unitTime\": 60000,\n         \"tierPlan\": \"FREE\",\n         \"tierLevel\": \"api\",\n         \"stopOnQuotaReach\": true,\n         \"requestCount\": 20,\n         \"description\": \"Allows 20 request(s) per minute.\",\n         \"name\": \"Gold\",\n         \"attributes\": {}\n      },\n            {\n         \"unitTime\": 60000,\n         \"tierPlan\": \"FREE\",\n         \"tierLevel\": \"api\",\n         \"stopOnQuotaReach\": true,\n         \"requestCount\": 5,\n         \"description\": \"Allows 5 request(s) per minute.\",\n         \"name\": \"Silver\",\n         \"attributes\": {}\n      },\n            {\n         \"unitTime\": 0,\n         \"tierPlan\": null,\n         \"policyLevel\": \"api\",\n         \"stopOnQuotaReach\": true,\n         \"requestCount\": 0,\n         \"description\": \"Allows unlimited requests\",\n         \"name\": \"Unlimited\",\n         \"attributes\": {}\n      }\n   ],\n   \"next\": \"\",\n   \"count\": 4\n}"
      summary: Get all throttling policies for the given type
      operationId: getAllThrottlingPolicies
      description: |
        This operation can be used to list the available policies for a given policy level. Tier level should be specified as a path parameter and should be one of `subscription` and `api`.
        `subscription` is for Subscription Level policies and `api` is for Resource Level policies
      parameters:
        - $ref: '#/parameters/limit'
        - $ref: '#/parameters/offset'
        - $ref: '#/parameters/policyLevel'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - Throttling Policies
      responses:
        200:
          description: |
            OK.
            List of policies returned.
          schema:
            $ref: '#/definitions/ThrottlingPolicyList'
          headers:
            Content-Type:
              description: The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'


  ######################################################
  # The "Individual Tier" resource APIs
  ######################################################
  '/throttling-policies/{policyLevel}/{policyName}':

    #-----------------------------------------------------
    # Retrieve a certain policy
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://127.0.0.1:9443/api/am/publisher/v1/policies/api/Bronze"
      x-wso2-request: |
        GET https://127.0.0.1:9443/api/am/publisher/v1/policies/api/Bronze
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"unitTime\": 60000,\n   \"tierPlan\": \"FREE\",\n   \"policyLevel\": \"api\",\n   \"stopOnQuotaReach\": true,\n   \"requestCount\": 1,\n   \"description\": \"Allows 1 request(s) per minute.\",\n   \"name\": \"Bronze\",\n   \"attributes\": {}\n}"
      summary: Get details of a policy
      operationId: getThrottlingPolicyByName
      description: |
        This operation can be used to retrieve details of a single policy by specifying the policy level and policy name.
      parameters:
        - $ref: '#/parameters/policyName'
        - $ref: '#/parameters/policyLevel'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - Throttling Policies
      responses:
        200:
          description: |
            OK.
            Tier returned
          schema:
            $ref: '#/definitions/ThrottlingPolicy'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested Tier does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Global Mediation Policy" resource APIs
  ######################################################
  /mediation-policies:

    #-----------------------------------------------------------------------------------------
    # Retrieving the list of all global mediation sequences under a given search condition
    #-----------------------------------------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:mediation_policy_view
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" https://localhost:9443/api/am/publisher/v1/mediation-policies"
      x-wso2-request: |
        GET https://localhost:9443/api/am/publisher/v1/mediation-policies
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{\r\n   \"count\": 10,\r\n   \"next\": null,\r\n   \"previous\": null,\r\n   \"list\":    [\r\n            {\r\n         \"name\": \"debug_json_fault\",\r\n         \"id\": \"563de8f3-dd1d-4ec7-afc2-d158c663ed34\",\r\n         \"type\": \"fault\"\r\n      },\r\n            {\r\n         \"name\": \"json_fault\",\r\n         \"id\": \"f9c36f4d-a2b6-41e7-b311-d358a47916be\",\r\n         \"type\": \"fault\"\r\n      },\r\n            {\r\n         \"name\": \"json_to_xml_in_message\",\r\n         \"id\": \"3921225b-7918-4b95-a851-22c4e4e3e911\",\r\n         \"type\": \"in\"\r\n      },\r\n            {\r\n         \"name\": \"debug_in_flow\",\r\n         \"id\": \"2bc15f93-4455-4763-89b8-83600fb9d731\",\r\n         \"type\": \"in\"\r\n      },\r\n            {\r\n         \"name\": \"log_in_message\",\r\n         \"id\": \"4d287cca-76ab-44ca-b22e-919fc27c50e3\",\r\n         \"type\": \"in\"\r\n      },\r\n            {\r\n         \"name\": \"preserve_accept_header\",\r\n         \"id\": \"3776b215-b3bc-40b6-bdcb-06efa7de64be\",\r\n         \"type\": \"in\"\r\n      },\r\n            {\r\n         \"name\": \"xml_to_json_in_message\",\r\n         \"id\": \"50ac2002-769e-4f90-8549-6d0248dff7d2\",\r\n         \"type\": \"in\"\r\n      },\r\n            {\r\n         \"name\": \"xml_to_json_out_message\",\r\n         \"id\": \"2af75853-ed75-4d25-81aa-0ebbeca691ea\",\r\n         \"type\": \"out\"\r\n      },\r\n            {\r\n         \"name\": \"json_to_xml_out_message\",\r\n         \"id\": \"d9fa3ffc-f6b6-4171-ab97-eb44196cb66e\",\r\n         \"type\": \"out\"\r\n      },\r\n            {\r\n         \"name\": \"debug_out_flow\",\r\n         \"id\": \"260b7701-4071-46bd-9b66-900ac6fffed6\",\r\n         \"type\": \"out\"\r\n      },\r\n            {\r\n         \"name\": \"apply_accept_header\",\r\n         \"id\": \"15c17c2f-33e3-4c37-a262-04dfa49983a4\",\r\n         \"type\": \"out\"\r\n      },\r\n            {\r\n         \"name\": \"log_out_message\",\r\n         \"id\": \"d37dca41-c048-492a-82cf-9a2292c6fff0\",\r\n         \"type\": \"out\"\r\n      }\r\n   ]\r\n}"
      x-examples:
        $ref: docs/examples/mediation-policies/mediation_policies_get.yaml
      summary: |
        Get all global level mediation policies
      operationId: getAllGlobalMediationPolicies
      description: |
        This operation provides you a list of available all global level mediation policies.
      parameters:
        - $ref : '#/parameters/limit'
        - $ref : '#/parameters/offset'
        - name : query
          in: query
          description: "-Not supported yet-"
          type: string
        - $ref : "#/parameters/If-None-Match"
      tags:
        - Global Mediation Policies
      responses:
        200:
          description: |
            OK.
            List of mediation policies is returned.
          schema:
            $ref: '#/definitions/MediationList'
          headers:
            Content-Type:
              description: The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

  ###################################################################
  # The "Individual Global mediation policy content" resource
  ###################################################################
  /mediation-policies/{mediationPolicyId}/content:

    #---------------------------------------------------------------
    # Retrieve a particular Global mediation sequence content
    #---------------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      summary: Downloadt specific global mediation policy
      operationId: getGlobalMediationPolicyContent
      description: |
        This operation can be used to download a particular global mediation policy.
      parameters:
        - $ref: '#/parameters/mediationPolicyId'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - Global Mediation Policy
      responses:
        200:
          description: |
            OK.
            Mediation policy returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested file does not exist.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Certificate Management" resource APIs
  ######################################################

  /apis/{apiId}/client-certificates:
    #-------------------------------------------------------------------
    # Retrieve/ Search the uploaded certificates.
    #-------------------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:client_certificates_view
      produces:
        - application/json
      x-wso2-curl: "curl -X GET \
                      https://localhost:9443/api/am/publisher/v1/client-certificates \
                      -H 'authorization: Bearer f80b8c34-01bc-3ac2-99b6-4873e45c861c'"
      x-wso2-request: "GET https://localhost:9443/api/am/publisher/v1/client-certificates \ -H 'authorization:
      Bearer f80b8c34-01bc-3ac2-99b6-4873e45c861c'"
      x-wso2-response: "HTTP/1.1 200 OK \
                        {\"count\":1,\"next\":\"\",\"previous\":\"\",\"certificates\":[{\"alias\":\"newtest1\",
                         \"apiId\":\"admin-mesting12da1-1.0.0\",\"tier\":\"Bronze\"}],\"pagination\":{\"total\":1,
                         \"offset\":0,\"limit\":25}}"
      summary: Retrieve/ Search uploaded Client Certificates.
      description: |
        This operation can be used to retrieve and search the uploaded client certificates.
      tags:
        - Client Certificates
      parameters:
        - $ref: '#/parameters/limit'
        - $ref: '#/parameters/offset'
        - in: query
          name: alias
          required: false
          type: string
          description: Alias for the client certificate
        - in: path
          name: apiId
          required: true
          type: string
          description: UUID of the API
      responses:
        '200':
          description: >
            OK. Successful response with the list of matching certificate
            information in the body.
          schema:
            $ref: '#/definitions/ClientCertificates'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        '400':
          description: |
            Bad Request.
            Failure due to not providing alias or server is not configured to support mutual SSL authentication.
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
          schema:
            $ref: '#/definitions/Error'

    #-------------------------------------------------------------------
    # Upload client certificate resource api.
    #-------------------------------------------------------------------
    post:
      security:
        - OAuth2Security:
            - apim:client_certificates_add
      consumes:
        - multipart/form-data
      x-wso2-curl: "curl -X POST \
                      https://localhost:9443/api/am/publisher/v1/client-certificates \
                      -H 'authorization: Bearer f2f562bd-f6d9-3fad-b48d-72ab5702c98a' \
                      -H 'content-type: multipart/form-data' \
                      -F certificate=@test.crt \
                      -F alias=alias \
                      -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b \
                      -F tier=Gold"
      x-wso2-request: "POST https://localhost:9443/api/am/publisher/v1/client-certificates \
                                                  -H 'authorization: Bearer f2f562bd-f6d9-3fad-b48d-72ab5702c98a' \
                                                  -H 'content-type: multipart/form-data' \
                                                  -F certificate=@test.crt \
                                                  -F alias=alias \
                                                  -F apiId=fea749dd-d548-4a8b-b308-34903b39a34b \
                                                  -F tier=Gold"
      x-wso2-response: "HTTP/1.1 201 Created \
                        Location: https://localhost:9443/api/am/publisher/v1/client-certificates?alias=newtest1 \
                        Date: Tue, 09 Oct 2018 16:18:10 GMT \
                        Content-Type: application/json \
                        Transfer-Encoding: chunked \
                        Server: WSO2 Carbon Server \
                        {\"alias\":\"alias\",\"apiId\":\"fea749dd-d548-4a8b-b308-34903b39a34b\",\"tier\":\"Gold\"}"
      summary: Upload a new certificate.
      description: |
        This operation can be used to upload a new certificate for an endpoint.
      parameters:
        - in: formData
          name: certificate
          description: The certificate that needs to be uploaded.
          required: true
          type: file
        - in: formData
          name: alias
          description: Alias for the certificate
          required: true
          type: string
        - in: path
          name: apiId
          description: apiId to which the certificate should be applied.
          required: true
          type: string
        - in: formData
          name: tier
          description: apiId to which the certificate should be applied.
          required: true
          type: string
      tags:
        - Client Certificates
      responses:
        '200':
          description: |
            OK.
            The Certificate added successfully.
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
          schema:
            $ref: '#/definitions/ClientCertMetadata'
        '400':
          description: |
            Bad Request.
            Failures due to existing alias or expired certificate.
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
            Failed to add the Certificate due to an Internal Server Error
          schema:
            $ref: '#/definitions/Error'

  #-------------------------------------------------------------------
  # Update certificate resource.
  #-------------------------------------------------------------------
  /apis/{apiId}/client-certificates/{alias}:
    put:
      security:
        - OAuth2Security:
            - apim:client_certificates_view
      consumes:
        - multipart/form-data
      x-wso2-curl: "curl -X PUT \
                      https://localhost:9443/api/am/publisher/v1/client-certificates/newtest1 \
                      -H 'authorization: Bearer f80b8c34-01bc-3ac2-99b6-4873e45c861c' \
                      -F tier=Bronze"
      x-wso2-request: "PUT https://localhost:9443/api/am/publisher/v1/client-certificates/newtest1 \
                                      -H 'authorization: Bearer f80b8c34-01bc-3ac2-99b6-4873e45c861c'\ -F tier=Bronze"
      x-wso2-response: "HTTP/1.1 200 OK\r\n
                        {\r\n\"alias\":\"newtest1\",\r\n\"apiId\":\"fea749dd-d548-4a8b-b308-34903b39a34b\",\r\n
                         \"tier\":\"Gold\"\r\n}\r\n"
      summary: Update a certificate.
      description: |
        This operation can be used to update an uploaded certificate.
      parameters:
        - in: formData
          name: certificate
          description: The certificate that needs to be uploaded.
          required: false
          type: file
        - in: path
          name: alias
          description: Alias for the certificate
          required: true
          type: string
        - in: formData
          name : tier
          description: The tier of the certificate
          required: false
          type: string
        - in: path
          name: apiId
          description: The api identifier
          required: true
          type: string
      tags:
        - Client Certificates
      responses:
        '200':
          description: |
            OK.
            The Certificate updated successfully.
          schema:
            $ref: '#/definitions/ClientCertMetadata'
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
        '400':
          description: |
            Bad Request.
            Failure due to not providing alias.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: |
            Not Found.
            Updating certificate failed. Alias not found or server is not configured to support mutual SSL
            authentication.
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
          schema:
            $ref: '#/definitions/Error'

    #-------------------------------------------------------------------
    # Delete Certificate resource
    #-------------------------------------------------------------------
    delete:
      security:
        - OAuth2Security:
            - apim:client_certificates_update
      x-wso2-curl:
        "curl -X DELETE \
           https://localhost:9443/api/am/publisher/v1/client-certificates/newtest1 \
           -H 'authorization: Bearer f80b8c34-01bc-3ac2-99b6-4873e45c861c' "
      x-wso2-request: "DELETE https://localhost:9443/api/am/publisher/v1/client-certificates/newtest1 \
                                         -H 'authorization: Bearer f80b8c34-01bc-3ac2-99b6-4873e45c861c'"
      x-wso2-response: "HTTP/1.1 200 OK"
      summary: Delete a certificate.
      description: |
        This operation can be used to delete an uploaded certificate.
      parameters:
        - in: path
          name: alias
          description: |
            The alias of the certificate that should be deleted.
          required: true
          type: string
        - in: path
          name: apiId
          description: The api identifier
          required: true
          type: string
      tags:
        - Client Certificates
      responses:
        '200':
          description: |
            OK.
            The Certificate deleted successfully.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        '400':
          description: |
            Bad Request.
            Alias not found or server is not configured to support mutual SSL authentication.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: |
            Not Found. |
            Failed to delete the certificate. Certificate could not found for
            the given alias
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
          schema:
            $ref: '#/definitions/Error'

    #-------------------------------------------------------------------
    # Get certificate information resource.
    #-------------------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:client_certificates_view
      produces:
        - application/json
      x-wso2-curl: "curl -X GET \
                      https://localhost:9443/api/am/publisher/v1/client-certificates/newtest1 \
                      -H 'authorization: Bearer f80b8c34-01bc-3ac2-99b6-4873e45c861c'"
      x-wso2-request: "GET https://apis.wso2.com/api/am/publisher/v1/client-certificates/newtest1 Authorization:
      Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
      x-wso2-response: "HTTP/1.1 200 OK
                        Date: Tue, 09 Oct 2018 16:25:43 GMT
                        Content-Type: application/json
                        Transfer-Encoding: chunked
                        Server: WSO2 Carbon Server
                        {\"status\":\"Active\",\"validity\":{\"from\":\"Fri Sep 14 15:46:22 IST 2018\",\"to\":\"Sat Sep
                         14 15:46:22 IST 2019\"},\"version\":\"3\",\"subject\":\"EMAILADDRESS=wso2@wso2.com,
                         CN=WSO2, OU=test, O=WSO2, L=colombo, ST=Some-State, C=CA\"}"
      summary: Get the certificate information.
      description: |
        This operation can be used to get the information about a certificate.
      parameters:
        - in: path
          name: alias
          type: string
          required: true
        - in: path
          name: apiId
          description: The api identifier
          required: true
          type: string
      tags:
        - Client Certificates
      responses:
        '200':
          description: |
            OK.
          schema:
            $ref: '#/definitions/CertificateInfo'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        '400':
          description: |
            Bad Request.
            Alias not found or server is not configured to support mutual SSL authentication.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: |
            Not Found.
            Alias not found
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
          schema:
            $ref: '#/definitions/Error'

  #-------------------------------------------------------------------
  # Download the certificate which matches the alias.
  #-------------------------------------------------------------------
  /apis/{apiId}/client-certificates/{alias}/content:
    get:
      security:
        - OAuth2Security:
            - apim:client_certificates_view
      x-wso2-curl: "curl -X GET \
                      https://localhost:9443/api/am/publisher/v1/client-certificates/newtest1/content \
                      -H 'authorization: Bearer f80b8c34-01bc-3ac2-99b6-4873e45c861c'"
      x-wso2-request: "GET https://apis.wso2.com/api/am/publisher/v1/certificates/wso2carbon/content Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
      x-wso2-response: "HTTP/1.1 200 OK \
                        Content-Disposition: attachment; filename=\"newtest1.crt\" \
                         Date: Tue, 09 Oct 2018 16:21:25 GMT
                         Content-Type: application/octet-stream
                         Content-Length: 997
                         Server: WSO2 Carbon Server"
      summary: Download a certificate.
      description: |
        This operation can be used to download a certificate which matches the given alias.
      parameters:
        - in: path
          name: apiId
          description: The api identifier
          required: true
          type: string
        - in: path
          name: alias
          type: string
          required: true
      tags:
        - Client Certificates
      responses:
        '200':
          description: |
            OK.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        '400':
          description: |
            Bad Request.
            Alias not provided or server is not configured to support mutual SSL authentication.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: |
            Not Found. Certificate for the Alias not found.
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Certificate Management" resource APIs
  ######################################################

  /endpoint-certificates:
    #-------------------------------------------------------------------
    # Retrieve/ Search the uploaded certificates.
    #-------------------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:ep_certificates_view
      produces:
        - application/json
      x-wso2-curl: "curl -X GET -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" \"https://localhost:9443/api/am/publisher/v1/certificates\""
      x-wso2-request: "GET https://localhost:9443/api/am/publisher/v1/certificates?alias=wso2carbon&endpoint=https://www.abc.com"
      x-wso2-response: "HTTP/1.1 200 OK \n\n{\n  \"count\":1,\n  \"next\":\"\",\n  \"previous\":\"\",\n\"certificates\":[\n   {\n    \"alias\":\"wso2carbon\",\n    \"endpoint\":\"https://www.abc.com\"\n   }\n],\n  \"pagination\":{\n    \"total\":1,\n          \"offset\":0,\n          \"limit\":25\n   } \n}"
      summary: Retrieve/Search uploaded certificates.
      description: |
        This operation can be used to retrieve and search the uploaded certificates.
      tags:
        - Endpoint Certificates
      parameters:
        - $ref: '#/parameters/limit'
        - $ref: '#/parameters/offset'
        - in: query
          name: alias
          required: false
          type: string
          description: Alias for the certificate
        - in: query
          name: endpoint
          required: false
          type: string
          description: Endpoint of which the certificate is uploaded
      responses:
        '200':
          description: >
            OK. Successful response with the list of matching certificate
            information in the body.
          schema:
            $ref: '#/definitions/Certificates'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        '400':
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: |
            Not Found.
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
          schema:
            $ref: '#/definitions/Error'

    #-------------------------------------------------------------------
    # Upload certificate resource api.
    #-------------------------------------------------------------------
    post:
      security:
        - OAuth2Security:
            - apim:ep_certificates_add
      consumes:
        - multipart/form-data
      x-wso2-curl: "curl -X POST -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: multipart/form-data\"  -F \"certificate=@/home/user/wso2carbon.cert\" -F \"alias=wso2carbon\" -F \"endpoint=https://www.abc.com\" \"https://localhost:9443/api/am/publisher/v1/certificates/certificate\""
      x-wso2-request: "POST https://localhost:9443/api/am/publisher/v1/certificates/certificate \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -F \"certificate=/home/user/wso2carbon.cert\" -F \"alias=wso2carbon\" -F \"endpoint=https://www.abc.com\""
      x-wso2-response: "HTTP/1.1 201 Created
                        Location: https://localhost:9443/api/am/publisher/v1/client-certificates?alias=newtest1
                        Date: Fri, 05 Oct 2018 09:50:48 GMT
                        Content-Type: application/json
                        Transfer-Encoding: chunked
                        Server: WSO2 Carbon Server
                        {\"alias\": \"newtest1\",\"apiId\": \"4624bdfb-6acd-465a-8454-bac9c4c94d88\",\"tier\": \"Gold\"}"
      summary: Upload a new Certificate.
      description: |
        This operation can be used to upload a new certificate for an endpoint.
      parameters:
        - in: formData
          name: certificate
          description: The certificate that needs to be uploaded.
          required: true
          type: file
        - in: formData
          name: alias
          description: Alias for the certificate
          required: true
          type: string
        - in: formData
          name: endpoint
          description: Endpoint to which the certificate should be applied.
          required: true
          type: string
      tags:
        - Endpoint Certificates
      responses:
        '200':
          description: |
            OK.
            The Certificate added successfully.
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
          schema:
            $ref: '#/definitions/CertMetadata'
        '400':
          description: |
            Bad Request.
            Invalid request or validation error.
            * Failures due to existing alias or expired certificate.
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
            * Failed to add the Certificate due to an Internal Server Error
          schema:
            $ref: '#/definitions/Error'

  #-------------------------------------------------------------------
  # Update certificate resource.
  #-------------------------------------------------------------------
  /endpoint-certificates/{alias}:
    put:
      security:
        - OAuth2Security:
            - apim:ep_certificates_update
      consumes:
        - multipart/form-data
      x-wso2-curl: "curl -X PUT -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type:multipart/form-data\" -F \"certificate=@/home/user/wso2carbon.cert\" \"https://localhost:9443/api/am/publisher/v1/certificates/wso2carbon\""
      x-wso2-request: "PUT https://localhost:9443/api/am/publisher/v1/certificates/wso2carbon Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 -F  \"certificate=@/home/user/wso2carbon.cert\""
      x-wso2-response: "HTTP/1.1 200 OK\r\n {\"alias\":wso2carbon,\"endpoint\":\"https://www.abc.com\"}"
      summary: Update a certificate.
      description: |
        This operation can be used to update an uploaded certificate.
      parameters:
        - in: formData
          name: certificate
          description: The certificate that needs to be uploaded.
          required: true
          type: file
        - in: path
          name: alias
          description: Alias for the certificate
          required: true
          type: string
      tags:
        - Endpoint Certificates
      responses:
        '200':
          description: |
            OK.
            The Certificate updated successfully.
          schema:
            $ref: '#/definitions/CertMetadata'
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
        '400':
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: |
            Not Found.
            Updating certificate failed. Alias not found
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
          schema:
            $ref: '#/definitions/Error'

    #-------------------------------------------------------------------
    # Delete Certificate resource
    #-------------------------------------------------------------------
    delete:
      security:
        - OAuth2Security:
            - apim:ep_certificates_update
      x-wso2-curl:
        "curl -X DELETE -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://localhost:9443/api/am/publisher/v1/certificates/wso2carbon\""
      x-wso2-request: "DELETE https://localhost:9443/api/am/publisher/v1/certificates/wso2carbon Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
      x-wso2-response: HTTP/1.1 200 OK
      summary: Delete a certificate.
      description: |
        This operation can be used to delete an uploaded certificate.
      parameters:
        - in: path
          name: alias
          description: |
            The alias of the certificate that should be deleted.
          required: true
          type: string
      tags:
        - Endpoint Certificates
      responses:
        '200':
          description: |
            OK.
            The Certificate deleted successfully.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        '400':
          description: |
            Bad Request.

            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: |
            Not Found. |
            Failed to delete the certificate. Certificate could not found for
            the given alias
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
          schema:
            $ref: '#/definitions/Error'

    #-------------------------------------------------------------------
    # Get certificate information resource.
    #-------------------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:ep_certificates_view
      produces:
        - application/json
      x-wso2-curl: "curl -X GET \"https://apis.wso2.com/api/am/publisher/v1/certificates/wso2carbon\" -H  \"accept: application/json\""
      x-wso2-request: "GET https://apis.wso2.com/api/am/publisher/v1/certificates/wso2carbon Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
      x-wso2-response: "HTTP/1.1 200 OK \nContent-Type: application/json\r\n {\n  \"status\":\"Active\",\n  \"validity\":{\n    \"from\":\"Fri May 04 19:01:01 IST 2018\",\n    \"to\":\"Thu Aug 02 19:01:01 IST 2018\"\n  }\n,  \"version\":\"3\",\n  \"subject\":\"CN=wso2.com, OU=wso2, O=wso2, L=Colombo, ST=Western, C=LK\"\n}"
      summary: Get the certificate information.
      description: |
        This operation can be used to get the information about a certificate.
      parameters:
        - in: path
          name: alias
          type: string
          required: true
      tags:
        - Endpoint Certificates
      responses:
        '200':
          description: |
            OK.
          schema:
            $ref: '#/definitions/CertificateInfo'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        '400':
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: |
            Not Found.
            Alias not found
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
          schema:
            $ref: '#/definitions/Error'

  #-------------------------------------------------------------------
  # Download the certificate which matches the alias.
  #-------------------------------------------------------------------
  /endpoint-certificates/{alias}/content:
    get:
      security:
        - OAuth2Security:
            - apim:ep_certificates_view
      x-wso2-curl: "curl -X GET \"https://apis.wso2.com/api/am/publisher/v1/certificates/wso2carbon/content\" -H \"accept: application/json\""
      x-wso2-request: "GET https://apis.wso2.com/api/am/publisher/v1/certificates/wso2carbon/content Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
      x-wso2-response: "HTTP/1.1 200 OK\r\n [content of the certificate]"
      summary: Download a certificate.
      description: |
        This operation can be used to download a certificate which matches the given alias.
      parameters:
        - in: path
          name: alias
          type: string
          required: true
      tags:
        - Endpoint Certificates
      responses:
        '200':
          description: |
            OK.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        '400':
          description: |
            Bad Request.
            Invalid request or validation error.
            *
          schema:
            $ref: '#/definitions/Error'
        '404':
          description: |
            Not Found. Certificate for the Alias not found.
          schema:
            $ref: '#/definitions/Error'
        '500':
          description: |
            Internal Server Error
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Content Search Results" resource APIs
  ######################################################
  /search:

    #-----------------------------------------------------
    # Retrieve the matching results
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      produces:
        - application/json
      x-examples:
        $ref: docs/examples/apis/search_get.yaml
      summary: |
        Retrieve/Search APIs and API Documents by content
      description: |
        This operation provides you a list of available APIs and API Documents qualifying the given keyword match.

      parameters:
        - $ref : '#/parameters/limit'
        - $ref : '#/parameters/offset'
        - name : query
          in: query
          description: |
            **Search**.

            You can search by proving a keyword.

          type: string
        - $ref : "#/parameters/If-None-Match"
      tags:
        - Unified Search
      responses:
        200:
          description: |
            OK.
            List of qualifying APIs and API documents is returned.
          schema:
            $ref: '#/definitions/SearchResultList'
          headers:
            Content-Type:
              description: The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'


    ######################################################
    # The "API Product" resource APIs
    ######################################################
    #-----------------------------------------------------
    # Retrieving the list of all API Products qualifying under a given search condition
    #-----------------------------------------------------
  /api-products:
    #-----------------------------------------------------
    # get API Product -API Product (Collection)
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_publish
      summary: |
        Retrieve/Search API Products
      description: |
        This operation provides you a list of available API Products qualifying under a given search condition.

        Each retrieved API Product is represented with a minimal amount of attributes. If you want to get complete details of an API Product, you need to use **Get details of an API Product** operation.
      parameters:
        - $ref : '#/parameters/limit'
        - $ref : '#/parameters/offset'
        - name : query
          in: query
          description: |
          type: string
        - $ref : "#/parameters/Accept"
        - $ref : "#/parameters/If-None-Match"
      tags:
        - API Products
      responses:
        200:
          description: |
            OK.
            List of qualifying API Products is returned.
          schema:
            $ref: '#/definitions/APIProductList'
          headers:
            Content-Type:
              description: The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Create a new API Product -API Product (Individual)
    #-----------------------------------------------------
    post:
      security:
        - OAuth2Security:
            - apim:api_publish
      summary: Create a new API Product
      description: |
        This operation can be used to create a new API Product specifying the details of the API Product in the payload.
      parameters:
        - in: body
          name: body
          description: |
            API object that needs to be added
          required: true
          schema:
            $ref: '#/definitions/APIProduct'
      tags:
        - API Products
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created object as entity in the body.
            Location header contains URL of newly created entity.
          schema:
            $ref: '#/definitions/APIProduct'
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        415:
          description: |
            Unsupported Media Type.
            The entity of the request was in a not supported format.
          schema:
            $ref: '#/definitions/Error'

  /api-products/{apiProductId}:
    delete:
      security:
        - OAuth2Security:
            - apim:api_publish
      summary: Delete an API Product
      description: |
        This operation can be used to delete an existing API Product proving the Id of the API Product.
      parameters:
        - $ref: '#/parameters/apiProductId'
        - $ref: '#/parameters/If-Match'
      tags:
        - API Products
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
        403:
          description: |
            Forbidden.
            The request must be conditional but no condition has been specified.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            Resource to be deleted does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Retrieve the details of an API definition
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_publish
      summary: Get details of an API Product
      description: |
        Using this operation, you can retrieve complete details of a single API Product. You need to provide the Id of the API to retrive it.
      parameters:
        - $ref: '#/parameters/apiProductId'
        - $ref: '#/parameters/Accept'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Products
      responses:
        200:
          description: |
            OK.
            Requested API Product is returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
          schema:
            $ref: '#/definitions/APIProduct'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Update the definition of an API product
    #-----------------------------------------------------
    put:
      security:
        - OAuth2Security:
            - apim:api_publish
      summary: Update an API product
      description: |
        This operation can be used to update an existing API product.
        But the properties `name`, `provider`
      parameters:
        - $ref: '#/parameters/apiProductId'
        - in: body
          name: body
          description: |
            API object that needs to be added
          required: true
          schema:
            $ref: '#/definitions/APIProduct'
        - $ref: '#/parameters/If-Match'
      tags:
        - API Products
      responses:
        200:
          description: |
            OK.
            Successful response with updated API product object
          schema:
            $ref: '#/definitions/APIProduct'
          headers:
            Location:
              description: |
                The URL of the newly created resource.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        403:
          description: |
            Forbidden.
            The request must be conditional but no condition has been specified.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  /api-products/{apiProductId}/thumbnail:
    #-------------------------------------------------------------------------------------------------
    # Downloads a thumbnail image of an API Product
    #-------------------------------------------------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_publish
      summary: Get thumbnail image
      description: |
        This operation can be used to download a thumbnail image of an API product.
      parameters:
        - $ref: '#/parameters/apiProductId'
        - $ref: '#/parameters/Accept'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Products
      responses:
        200:
          description: |
            OK.
            Thumbnail image returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested Document does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #----------------------------------------------------------------------------
    # Upload a thumbnail image to a certain API Product
    #----------------------------------------------------------------------------
    put:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:api_publish
      summary: Upload a thumbnail image
      description: |
        This operation can be used to upload a thumbnail image of an API Product. The thumbnail to be uploaded should be given as a form data parameter `file`.
      parameters:
        - $ref: '#/parameters/apiProductId'
        - in: formData
          name: file
          description: Image to upload
          type: file
          required: true
        - $ref: '#/parameters/If-Match'
      tags:
        - API Products
      responses:
        200:
          description: |
            OK.
            Image updated
          schema:
            $ref : '#/definitions/FileInfo'
          headers:
            Location:
              description: |
                The URL of the uploaded thumbnail image of the API Product.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'
  ################################################################
  # The swagger resource of "Individual API" resource APIs
  ################################################################

  /api-products/{apiProductId}/swagger:
    #-----------------------------------------------------
    # Retrieve the API swagger definition
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_publish
      summary: Get swagger definition
      description: |
        This operation can be used to retrieve the swagger definition of an API.
      parameters:
        - $ref: '#/parameters/apiProductId'
        - $ref: '#/parameters/Accept'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Products
      responses:
        200:
          description: |
            OK.
            Requested swagger document of the API is returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

  ###########################################################
  # Resource for checking if a given API Product is outdated
  ###########################################################

  /api-products/{apiProductId}/is-outdated:
    #----------------------------------------------------------------------------------------------------------
    # Retrieves the status indicating if an API Product is outdated due to updating of dependent APIs
    #----------------------------------------------------------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_publish
      summary: Get if API Product is outdated
      description: |
        This operation can be used to retrieve the status indicating if an API Product is outdated due to updating of dependent APIs
      parameters:
        - $ref: '#/parameters/apiProductId'
        - $ref: '#/parameters/Accept'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Products
      responses:
        200:
          description: |
            OK.
            Requested swagger document of the API is returned
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
          schema:
            $ref: '#/definitions/APIProductOutdatedStatus'
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'


  ######################################################
  # The "Document Collection" resource API Product
  ######################################################
  /api-products/{apiProductId}/documents:

    #-----------------------------------------------------
    # Retrieve the documents associated with an API Product that qualify under a search condition
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_publish
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://localhost:9443/api/am/publisher/v1/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents\""
      x-wso2-request: |
        GET https://localhost:9443/api/am/publisher/v1/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"previous\": \"\",\n   \"list\":    [\n            {\n         \"visibility\": \"API_LEVEL\",\n         \"sourceType\": \"INLINE\",\n         \"sourceUrl\": null,\n         \"otherTypeName\": null,\n         \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n         \"summary\": \"This is a sample documentation for v1\",\n         \"name\": \"PhoneVerification API Documentation\",\n         \"type\": \"HOWTO\"\n      },\n            {\n         \"visibility\": \"API_LEVEL\",\n         \"sourceType\": \"URL\",\n         \"sourceUrl\": \"http://wiki.cdyne.com/index.php/Phone_Verification\",\n         \"otherTypeName\": null,\n         \"documentId\": \"4145df31-04f1-440c-8d08-68952874622c\",\n         \"summary\": \"This is the URL for online documentation\",\n         \"name\": \"Online Documentation\",\n         \"type\": \"SAMPLES\"\n      }\n   ],\n   \"next\": \"\",\n   \"count\": 2\n}"
      summary: Get a list of documents of an API Product
      description: |
        This operation can be used to retrive a list of documents belonging to an API Product by providing the id of the API Product.
      parameters:
        - $ref: '#/parameters/apiProductId'
        - $ref: '#/parameters/limit'
        - $ref: '#/parameters/offset'
        - $ref: '#/parameters/Accept'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Product Documents
      responses:
        200:
          description: |
            OK.
            Document list is returned.
          schema:
            $ref: '#/definitions/DocumentList'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource. Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API Product does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Add a document to a certain API
    #-----------------------------------------------------
    post:
      security:
        - OAuth2Security:
            - apim:api_publish
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -H \"Content-Type: application/json\" -X POST -d @data.json \"https://localhost:9443/api/am/publisher/v1/api-products/96077508-fd01-4fae-bc64-5de0e2baf43c/documents\""
      x-wso2-request: "POST https://localhost:9443/api/am/publisher/v1/api-products/96077508-fd01-4fae-bc64-5de0e2baf43c/documents\nAuthorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\nContent-Type: application/json\n\n{\n    \"visibility\": \"API_LEVEL\",\n    \"sourceType\": \"INLINE\",\n    \"sourceUrl\": null,\n    \"otherTypeName\": null,\n    \"summary\": \"This is a sample documentation\",\n    \"name\": \"Introduction to PhoneVerification API\",\n    \"type\": \"HOWTO\"\n}"
      x-wso2-response: "HTTP/1.1 201 Created\nLocation: https://localhost:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058\nContent-Type: application/json\n\n{\n   \"visibility\": \"API_LEVEL\",\n   \"sourceType\": \"INLINE\",\n   \"sourceUrl\": null,\n   \"otherTypeName\": null,\n   \"documentId\": \"ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058\",\n   \"summary\": \"This is a sample documentation\",\n   \"name\": \"Introduction to PhoneVerification API\",\n   \"type\": \"HOWTO\"\n}"
      summary: Add a new document to an API Product
      description: |
        This operation can be used to add a new documentation to an API Product. This operation only adds the metadata of a document. To add the actual content we need to use **Upload the content of an API Product document ** API once we obtain a document Id by this operation.
      parameters:
        - $ref: '#/parameters/apiProductId'
        - in: body
          name: body
          description: |
            Document object that needs to be added
          required: true
          schema:
            $ref: '#/definitions/Document'
      tags:
        - API Product Documents
      responses:
        201:
          description: |
            Created.
            Successful response with the newly created Document object as entity in the body.
            Location header contains URL of newly added document.
          schema:
            $ref: '#/definitions/Document'
          headers:
            Location:
              description: |
                Location to the newly created Document.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error
          schema:
            $ref: '#/definitions/Error'
        415:
          description: |
            Unsupported media type.
            The entity of the request was in a not supported format.

            ######################################################
  # The "Individual Document" resource APIs
  ######################################################
  /api-products/{apiProductId}/documents/{documentId}:

    #-----------------------------------------------------
    # Retrieve a particular document of a certain API
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_publish
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://localhost:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\""
      x-wso2-request: |
        GET https://localhost:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"visibility\": \"API_LEVEL\",\n   \"sourceType\": \"INLINE\",\n   \"sourceUrl\": null,\n   \"otherTypeName\": null,\n   \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n   \"summary\": \"This is a sample documentation\",\n   \"name\": \"PhoneVerification API Documentation\",\n   \"type\": \"HOWTO\"\n}"
      summary: Get a document of an API
      description: |
        This operation can be used to retrieve a particular document's metadata associated with an API.
      parameters:
        - $ref: '#/parameters/apiProductId'
        - $ref: '#/parameters/documentId'
        - $ref: '#/parameters/Accept'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Product Documents
      responses:
        200:
          description: |
            OK.
            Document returned.
          schema:
            $ref: '#/definitions/Document'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested Document does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Update a particular document of a certain API Product
    #-----------------------------------------------------
    put:
      security:
        - OAuth2Security:
            - apim:api_publish
      x-wso2-curl: "curl -k -H \"Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a\" -H \"Content-Type: application/json\" -X PUT -d data.json \"https://localhost:9443/api/am/publisher/v1/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\""
      x-wso2-request: "PUT https://localhost:9443/api/am/publisher/v1/apis/96077508-fd01-4fae-bc64-5de0e2baf43c/documents/0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\nAuthorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a\nContent-Type: application/json\n\n{\n   \"visibility\": \"API_LEVEL\",\n   \"sourceType\": \"INLINE\",\n   \"sourceUrl\": null,\n   \"otherTypeName\": null,\n   \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n   \"summary\": \"This is a sample documentation for v1\",\n   \"name\": \"PhoneVerification API Documentation\",\n   \"type\": \"HOWTO\"\n}"
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"visibility\": \"API_LEVEL\",\n   \"sourceType\": \"INLINE\",\n   \"sourceUrl\": null,\n   \"otherTypeName\": null,\n   \"documentId\": \"0bcb7f05-599d-4e1a-adce-5cb89bfe58d5\",\n   \"summary\": \"This is a sample documentation for v1\",\n   \"name\": \"PhoneVerification API Documentation\",\n   \"type\": \"HOWTO\"\n}"
      summary: Update a document of an API Product
      description: |
        This operation can be used to update metadata of an API's document.
      parameters:
        - $ref: '#/parameters/apiProductId'
        - $ref: '#/parameters/documentId'
        - in: body
          name: body
          description: |
            Document object that needs to be added
          required: true
          schema:
            $ref: '#/definitions/Document'
        - $ref: '#/parameters/If-Match'
      tags:
        - API Product Documents
      responses:
        200:
          description: |
            OK.
            Document updated
          schema:
            $ref: '#/definitions/Document'
          headers:
            Location:
              description: |
                The URL of the updated document.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

    #-----------------------------------------------------
    # Delete a particular document of a certain API Product
    #-----------------------------------------------------
    delete:
      security:
        - OAuth2Security:
            - apim:api_publish
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -X DELETE https://localhost:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058"
      x-wso2-request: |
        DELETE https://localhost:9443/api/am/publisher/v1/apis/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/ffd5790d-b7a9-4cb6-b76a-f8b83ecdd058
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK"
      summary: Delete a document of an API Product
      description: |
        This operation can be used to delete a document associated with an API Product.
      parameters:
        - $ref: '#/parameters/apiProductId'
        - $ref: '#/parameters/documentId'
        - $ref: '#/parameters/If-Match'
      tags:
        - API Product Documents
      responses:
        200:
          description: |
            OK.
            Resource successfully deleted.
        404:
          description: |
            Not Found.
            Resource to be deleted does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  ################################################################
  # The content resource of "Individual Document" resource APIs
  ################################################################

  '/api-products/{apiProductId}/documents/{documentId}/content':

    #-------------------------------------------------------------------------------------------------
    # Downloads a FILE type document/get the inline content or source url of a certain document
    #-------------------------------------------------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_publish
      x-wso2-curl: "curl -k -H \"Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a\" \"https://localhost:9443/api/am/publisher/v1/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content\" > sample.pdf"
      x-wso2-request: |
        GET https://localhost:9443/api/am/publisher/v1/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content
        Authorization:Bearer b0982cd2aacd463ff5f63cd5ebe58f4a
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Disposition: attachment; filename=\"sample.pdf\"\nContent-Type: application/octet-stream\nContent-Length: 7802\n\n%PDF-1.4\n%äüöß\n2 0 obj\n<</Length 3 0 R/Filter/FlateDecode>>\nstream\n..\n>>\nstartxref\n7279\n%%EOF"
      summary: Get the content of an API Product document
      description: |
        This operation can be used to retrive the content of an API's document.

        The document can be of 3 types. In each cases responses are different.

        1. **Inline type**:
           The content of the document will be retrieved in `text/plain` content type

           _Sample cURL_ : `curl -k -H "Authorization:Bearer 579f0af4-37be-35c7-81a4-f1f1e9ee7c51" -F inlineContent=@"docs.txt" -X POST "https://localhost:9443/api/am/publisher/v1/apis/995a4972-3178-4b17-a374-756e0e19127c/documents/43c2bcce-60e7-405f-bc36-e39c0c5e189e/content`
        2. **FILE type**:
           The file will be downloaded with the related content type (eg. `application/pdf`)
        3. **URL type**:
            The client will recieve the URL of the document as the Location header with the response with - `303 See Other`
      parameters:
        - $ref: '#/parameters/apiProductId'
        - $ref: '#/parameters/documentId'
        - $ref: '#/parameters/Accept'
        - $ref: '#/parameters/If-None-Match'
      tags:
        - API Product Documents
      responses:
        200:
          description: |
            OK.
            File or inline content returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        303:
          description: |
            See Other.
            Source can be retrived from the URL specified at the Location header.
          headers:
            Location:
              description: |
                The Source URL of the document.
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested Document does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'

    #----------------------------------------------------------------------------
    # Upload a file or add inline content to a document of a certain API Product
    #----------------------------------------------------------------------------
    post:
      consumes:
        - multipart/form-data
      security:
        - OAuth2Security:
            - apim:api_publish
      x-wso2-curl: "curl -k -H \"Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" -F file=@\"sample.pdf\" -X POST \"https://localhost:9443/api/am/publisher/v1/api-products/890a4f4d-09eb-4877-a323-57f6ce2ed79b/documents/daf732d3-bda2-46da-b381-2c39d901ea61/content\""
      x-wso2-request: |
        POST https://localhost:9443/api/am/publisher/v1/api-products/8848faaa-7fd1-478a-baa2-48a4ebb92c98/documents/b3a79270-02bb-4e39-9ac1-90ce8f6c84af/content
        Authorization:Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
        Content-Length: 8004
        Content-Type: multipart/form-data; boundary=------------------------7b9a53f1ffa452b9

        --------------------------7b9a53f1ffa452b9
        Content-Disposition: form-data; name="file"; filename="sample.pdf"
        Content-Type: application/octet-stream

        [file content]

        --------------------------7b9a53f1ffa452b9--
      x-wso2-response: "HTTP/1.1 201 Created\nLocation: https://localhost:9443/api/am/publisher/v1/apis/8848faaa-7fd1-478a-baa2-48a4ebb92c98/documents/b3a79270-02bb-4e39-9ac1-90ce8f6c84af/content\nContent-Type: application/json\n\n{\n    \"visibility\":\"API_LEVEL\",\n    \"sourceType\":\"FILE\",\n    \"sourceUrl\":null,\n    \"otherTypeName\":null,\n    \"documentId\":\"daf732d3-bda2-46da-b381-2c39d901ea61\",\n    \"summary\":\"This is a sample documentation pdf\",\n    \"name\":\"Introduction to PhoneVerification API PDF\",\n    \"type\":\"HOWTO\"\n}"
      summary: Upload the content of an API Product document
      description: |
        Thid operation can be used to upload a file or add inline content to an API Product document.

        **IMPORTANT:**
        * Either **file** or **inlineContent** form data parameters should be specified at one time.
        * Document's source type should be **FILE** in order to upload a file to the document using **file** parameter.
        * Document's source type should be **INLINE** in order to add inline content to the document using **inlineContent** parameter.
      parameters:
        - $ref: '#/parameters/apiProductId'
        - $ref: '#/parameters/documentId'
        - in: formData
          name: file
          description: Document to upload
          type: file
          required: false
        - in: formData
          name: inlineContent
          description: Inline content of the document
          type: string
          required: false
        - $ref: '#/parameters/If-Match'
      tags:
        - API Product Documents
      responses:
        200:
          description: |
            OK.
            Document updated
          schema:
            $ref: '#/definitions/Document'
          headers:
            Location:
              description: |
                The URL of the updated content of the document.
              type: string
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
            Last-Modified:
              description: |
                Date and time the resource has been modifed the last time.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        400:
          description: |
            Bad Request.
            Invalid request or validation error.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The resource to be updated does not exist.
          schema:
            $ref: '#/definitions/Error'
        412:
          description: |
            Precondition Failed.
            The request has not been performed because one of the preconditions is not met.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # Check role existence in user-store
  ######################################################
  /roles/{roleId}:
    #-----------------------------------------------------
    # The role name existence check resource
    #-----------------------------------------------------
    head:
      security:
        - OAuth2Security:
            - apim:api_create
            - apim:api_publish
      operationId: validateSystemRole
      summary:
        Check given role name is already exist
      description: |
        Using this operation, user can check a given role name exists or not.
      parameters:
        - $ref : '#/parameters/roleId'
      tags:
        - Roles
      responses:
        200:
          description:
            OK.
            Requested role name exists.
        404:
          description:
            Not Found.
            Requested role name does not exist.

  ######################################################
  # Check role existence for the logged-in user
  ######################################################
  /me/roles/{roleId}:
    #-----------------------------------------------------
    # Validate role against logged-in user
    #-----------------------------------------------------
    head:
      security:
        - OAuth2Security:
            - apim:api_create
      operationId: validateUserRole
      summary:
        Validate whether the logged-in user has the given role
      description: |
        Using this operation, logged-in user can check whether he has given role.
      parameters:
        - $ref : '#/parameters/roleId'
      tags:
        - Roles
      responses:
        200:
          description:
            OK.
            Requested user has the role.
        404:
          description:
            Not Found.
            Requested user does not have the role.

  ######################################################
  # The External Store list to publish an API
  ######################################################
  /external-stores:
    #-----------------------------------------------------
    # Retrieve configured external store list
    #-----------------------------------------------------
    get:
      operationId: getAllExternalStores
      security:
        - OAuth2Security:
            - apim:api_view
      x-examples:
        $ref: docs/examples/external-stores/external_stores.yaml#/getAllExternalStores
      summary: Retrieve external store list to publish an API
      tags:
        - External Stores
      description: |
        Retrieve external stores list configured to publish an API
      responses:
        200:
          description: |
            OK.
            External Stores list returned
          schema:
            $ref: '#/definitions/ExternalStore'
        500:
          description: Error retrieving external stores
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The Publisher settings List
  ######################################################
  /settings:
    #-----------------------------------------------------
    # Retrieve publisher settings
    #-----------------------------------------------------
    get:
      summary: Retreive publisher settings
      security:
        - OAuth2Security:
            - apim:publisher_settings
      description: |
        Retreive publisher settings
      tags:
        - Settings
      responses:
        200:
          description: |
            OK.
            Settings returned
          schema:
            $ref: '#/definitions/Settings'
        404:
          description: |
            Not Found.
            Requested Settings does not exist.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The "Environment Collection" resource API
  ######################################################
  /settings/gateway-environments:

    #-----------------------------------------------------
    # Retrieve the list of environments configured for a certain API
    #-----------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://localhost:9443/api/am/publisher/v1/environments\""
      x-wso2-request: |
        GET https://localhost:9443/api/am/publisher/v1/environments
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-response: "HTTP/1.1 200 OK\nContent-Type: application/json\n\n{\n   \"list\": [   {\n      \"showInApiConsole\": true,\n      \"serverUrl\": \"https://localhost:9443/services/\",\n      \"endpoints\":       {\n         \"http\": \"http://localhost:8280\",\n         \"https\": \"https://localhost:8243\"\n      },\n      \"name\": \"Production and Sandbox\",\n      \"type\": \"hybrid\"\n   }],\n   \"count\": 1\n}"
      summary: Get all gateway environments
      description: |
        This operation can be used to retrieve the list of gateway environments available.
      parameters:
        - $ref: '#/parameters/apiId-Q'
      tags:
        - Settings
      responses:
        200:
          description: |
            OK.
            Environment list is returned.
          schema:
            $ref: '#/definitions/EnvironmentList'
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
            ETag:
              description: |
                Entity Tag of the response resource.
                Used by caches, or in conditional requests (Will be supported in future).
              type: string
        304:
          description: |
            Not Modified.
            Empty body because the client has already the latest version of the requested resource (Will be supported in future).
        404:
          description: |
            Not Found.
            Requested API does not exist.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # The tenant resource APIs
  ######################################################
  '/tenants':
    #--------------------------------------------------------
    # Retrieve tenants by state
    #--------------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:api_view
      x-examples:
        $ref: docs/examples/tenants/tenants.yaml
      summary: |
        Get get tenants by state
      description: |
        This operation is to get tenants by state
      operationId: getTenantsByState
      parameters:
        - name: state
          description: |
            The state represents the current state of the tenant

            Supported states are [ active, inactive]

          in: query
          type: string
          required: false
          default: 'active'
          enum:
            - active
            - inactive
        - $ref: '#/parameters/limit'
        - $ref: '#/parameters/offset'
      tags:
        - Tenants
      responses:
        200:
          description: |
            OK.
            Tenant names returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
          schema:
            $ref: '#/definitions/TenantList'
        404:
          description: |
            Not Found.
            Requested application does not exist.
          schema:
            $ref: '#/definitions/Error'
        406:
          description: |
            Not Acceptable.
            The requested media type is not supported
          schema:
            $ref: '#/definitions/Error'
  ####################################################
  # Publisher Alerts management REST API
  ####################################################
  '/alert-types':
    #--------------------------------------------------
    # Retrieve the list of api store alert types.
    #--------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:pub_alert_manage
      x-examples:
        $ref: docs/examples/alerts/alerts.yaml#/get
      operationId: getPublisherAlertTypes
      summary: |
        Get the list of API Publisher alert types.
      description: |
        This operation is used to get the list of supportd alert types for the 'publisher' agent.
      tags:
        - Alerts
      responses:
        200:
          description: |
            OK.
            The list of publisher alert types are returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
          schema:
            $ref: '#/definitions/AlertTypesList'
        500:
          description: |
            Internal Server Error.
            An internal server error occurred while retrieving the alert types.
          schema:
            $ref: '#/definitions/Error'

  '/alert-subscriptions':
    #--------------------------------------------------
    # Retrieve the list of alerts subscribed by the user.
    #--------------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:pub_alert_manage
      x-examples:
        $ref: docs/examples/alerts/alerts_subscriptions.yaml#/get
      summary: |
        Get the list of API Publisher alert types subscribed by the user.
      operationId: getSubscribedAlertTypes
      description: |
        This operation is used to get the list of subscribed alert types by the user.
      tags:
        - Alert Subscriptions
      responses:
        200:
          description: |
            OK.
            The list of subscribed alert types are returned.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
          schema:
            $ref: '#/definitions/AlertsInfo'
        500:
          description: |
            Internal Server Error
            An error occurred while retrieving subscribed alert types by user.
          schema:
            $ref: '#/definitions/Error'

    #--------------------------------------------------
    # Subscribe to the selected alert types by the user.
    #--------------------------------------------------
    put:
      security:
        - OAuth2Security:
            - apim:pub_alert_manage
      x-examples:
        $ref: docs/examples/alerts/alerts_subscriptions.yaml#/put
      summary: |
        Subscribe to the selected alert types by the user.
      operationId: subscribeToAlerts
      description: |
        This operation is used to get the list of subscribed alert types by the user.
      parameters:
        - in: body
          name: body
          description:
            The alerts list and the email list to subscribe.
          required: true
          schema:
            $ref: '#/definitions/AlertsInfo'
      tags:
        - Alert Subscriptions
      responses:
        201:
          description: |
            OK.
            Successful response with the newly subscribed alerts.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
          schema:
            $ref: '#/definitions/AlertsInfoResponse'
        400:
          description: |
            Bad Request.
            Invalid Request or request validation failure.
        500:
          description: |
            Internal Server Error
            An internal server error occurred while subscribing to alerts.
          schema:
            $ref: '#/definitions/Error'
    #--------------------------------------------------
    # Unsubscribe the user from all the alerts types
    #--------------------------------------------------
    delete:
      security:
        - OAuth2Security:
            - apim:pub_alert_manage
      x-examples:
        $ref: docs/examples/alerts/alerts_subscriptions.yaml#/delete
      summary: |
        Unsubscribe user from all the alert types.
      operationId: unsubscribeAllAlerts
      description: |
        This operation is used to unsubscribe the respective user from all the alert types.
      tags:
        - Alert Subscriptions
      responses:
        200:
          description: |
            OK.
            The user is unsubscribed from the alerts successfully.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
        500:
          description: |
            Internal Server Error
          schema:
            $ref: '#/definitions/Error'

  ##################################################
  # Alert configuration api
  #################################################
  '/alerts/{alertType}/configurations':
    #----------------------------------------------
    # Get the alert configs
    #----------------------------------------------
    get:
      security:
        - OAuth2Security:
            - apim:pub_alert_manage
      x-examples:
        $ref: docs/examples/alerts/alerts_config.yaml#/get
      summary: |
        Get all AbnormalRequestsPerMin alert configurations
      operationId: getAllAlertConfigs
      description: |
        This operation is used to get all configurations of the AbnormalRequestsPerMin alert type.
      tags:
        - Alert Configuration
      parameters:
        - $ref: '#/parameters/alertType'
      responses:
        200:
          description: |
            OK.
            The store alert configuration.
          headers:
            Content-Type:
              description: |
                The content type of the body.
              type: string
          schema:
            $ref: '#/definitions/AlertConfigList'
        500:
          description: |
            Internal Server Error
            An error occurred while retrieving subscribed alert types by user.
          schema:
            $ref: '#/definitions/Error'

  '/alerts/{alertType}/configurations/{configurationId}':
    #----------------------------------------------
    # Add alert config
    #----------------------------------------------
    put:
      security:
        - OAuth2Security:
            - apim:pub_alert_manage
      x-examples:
        $ref: docs/examples/alerts/alerts_config.yaml#/put
      summary: |
        Add AbnormalRequestsPerMin alert configurations.
      operationId: addAlertConfig
      description: |
        This operation is used to add configuration for the AbnormalRequestsPerMin alert type.
      parameters:
        - $ref: '#/parameters/alertType'
        - $ref: '#/parameters/configurationId'
        - in: body
          name: body
          description:
            Configuration for AbnormalRequestCount alert type
          required: true
          schema:
            $ref: '#/definitions/AlertConfigInfo'
      tags:
        - Alert Configuration
      responses:
        201:
          description: |
            Created.
            Successful response with newly created object as entity.
            Location header contains URL of newly created entity.
          headers:
            Location:
              description: |
                The location of the newly created entity.
              type: string
          schema:
            $ref: '#/definitions/AlertConfig'
        400:
          description: |
            Bad Request
            The request parameters validation failed.
          schema:
            $ref: '#/definitions/Error'
        500:
          description: |
            Internal Server Error
            An error occurred while retrieving subscribed alert types by user.
          schema:
            $ref: '#/definitions/Error'

    #----------------------------------------------
    # Delete alert configuration
    #----------------------------------------------
    delete:
      security:
        - OAuth2Security:
            - apim:pub_alert_manage
      x-examples:
        $ref: docs/examples/alerts/alerts_config.yaml#/delete
      summary: |
        Delete the selected configuration from AbnormalRequestsPerMin alert type.
      operationId: deleteAlertConfig
      description: |
        This operation is used to delete configuration from the AbnormalRequestsPerMin alert type.
      parameters:
        - $ref: '#/parameters/alertType'
        - $ref: '#/parameters/configurationId'
      tags:
        - Alert Configuration
      responses:
        200:
          description: |
            OK.
            The alert config is deleted successfully.
        400:
          description: |
            Bad Request
            The request parameters validation failed.
          schema:
            $ref: '#/definitions/Error'
        404:
          description: |
            Not Found.
            The provided alert configuration is not found.
          schema:
            $ref: '#/definitions/Error'
        500:
          description: |
            Internal Server Error
            An error occurred while retrieving subscribed alert types by user.
          schema:
            $ref: '#/definitions/Error'

  ######################################################
  # Check tenant existence
  ######################################################
  /tenants/{tenantDomain}:
    #-----------------------------------------------------
    # The tenant existence check resource
    #-----------------------------------------------------
    head:
      security:
        - OAuth2Security:
            - apim:api_view
      x-examples:
        $ref: docs/examples/tenants/tenants.yaml
      summary:
        Check whether the given tenant already exists
      description: |
        Using this operation, user can check whether a given tenant exists or not.
      operationId: getTenantExistence
      parameters:
        - $ref : '#/parameters/tenantDomain'
      tags:
        - Tenants
      responses:
        200:
          description:
            OK.
            Requested role name exists.
        404:
          description:
            Not Found.
            Requested role name does not exist.

  ####################################################
  # The "Label" resource API
  ######################################################
  /labels:

    #-----------------------------------------------------
    # Retrieve all labels
    #-----------------------------------------------------
    get:
      x-scope: apim:api_view
      x-wso2-request: |
        GET https://localhost:9443/api/am/publisher/v1/labels
        Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8
      x-wso2-curl: "curl -k -H \"Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8\" \"https://localhost:9443/api/am/publisher/v1/labels\""
      x-wso2-response: "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n{\r\n  \"count\": 1,\r\n  \"list\": [\r\n	{\r\n	\"id\":\"d7cf8523-9180-4255-84fa-6cb171c1f779\",\r\n	\"name\":\"internal\",\r\n	\"description\":\"label used for internal purpose\",\r\n	\"accessUrls\":[\r\n	  \"https://localhost:9095\"\r\n         ]\r\n       }\r\n   ]\r\n}"
      summary: Get all registered Labels
      description: |
        Get all registered Labels
      tags:
        - Label Collection
      responses:
        200:
          description: |
            OK.
            Labels returned
          schema:
            $ref: '#/definitions/LabelList'

######################################################
# Parameters - required by some of the APIs above
######################################################
parameters:

  # API Identifier
  # Specified as part of the path expression
  apiId:
    name: apiId
    in: path
    description: |
      **API ID** consisting of the **UUID** of the API.
    required: true
    type: string
  # API Identifier
  # Specified as part of the path expression
  endpointId:
    name: endpointId
    in: path
    description: |
      **Endpoint ID** consisting of the **UUID** of the Endpoint**.
    required: true
    type: string
  # API Identifier
  # Specified as part of the query string
  apiId-Q:
    name: apiId
    in: query
    description: |
      **API ID** consisting of the **UUID** of the API.
      The combination of the provider of the API, name of the API and the version is also accepted as a valid API I.
      Should be formatted as **provider-name-version**.
    required: true
    type: string

  # Label Type
  # Specified as part of the query string
  labelType-Q:
    name: labelType
    in: query
    description: |
      **API ID** consisting of the **UUID** of the API.
      The combination of the provider of the API, name of the API and the version is also accepted as a valid API I.
      Should be formatted as **provider-name-version**.
    required: false
    type: string


  # API name
  # Specified as part of the query string
  name:
    name: name
    in: path
    description: |
      Name of the API
    required: true
    type: string

  # API version
  # Specified as part of the query string
  version:
    name: version
    in: path
    description: |
      Version of the API
    required: true
    type: string

  # Document Identifier
  # Specified as part of the path expression
  documentId:
    name: documentId
    in: path
    description: |
      Document Identifier
    required: true
    type: string

  # Application Identifier
  # Specified as part of the path expression
  applicationId:
    name: applicationId
    in: path
    description: |
      **Application Identifier** consisting of the UUID of the Application.
    required: true
    type: string

  # Subscription Identifier
  # Specified as part of the path expression
  subscriptionId:
    name: subscriptionId
    in: path
    description: |
      Subscription Id
    required: true
    type: string

  # Mediation policy identifier
  # Specified as part of the path expression
  mediationPolicyId:
    name: mediationPolicyId
    in: path
    description: |
      Mediation policy Id
    required: true
    type: string

  # Resource policy identifier
  # Specified as part of the path expression
  resourcePolicyId:
    name: resourcePolicyId
    in: path
    description: |
      registry resource Id
    required: true
    type: string

  # Subscription Identifier
  # Specified as part of the query string
  subscriptionId-Q:
    name: subscriptionId
    in: query
    description: |
      Subscription Id
    required: true
    type: string

  # Tier Name
  # Specified as part of the path expression
  policyName:
    name: policyName
    in: path
    description: |
      Tier name
    required: true
    type: string

  # Tier Name
  # Specified as part of the query string
  policyName-Q:
    name: policyName
    in: query
    description: |
      Name of the policy
    required: true
    type: string

  # Tier Type
  # Specified as part of the path expression
  policyLevel:
    name: policyLevel
    in: path
    description: |
      List API or Application or Resource type policies.
    type: string
    enum:
      - api
      - subcription
    required: true

  # Tier Type
  # Specified as part of the query string
  policyLevel-Q:
    name: policyLevel
    in: query
    description: |
      List API or Application or Resource type policies.
    type: string
    enum:
      - api
      - subcription
    required: true

  # Used for pagination:
  # The maximum number of resoures to be returned by a GET
  limit:
    name: limit
    in: query
    description: |
      Maximum size of resource array to return.
    default: 25
    type: integer

  # The HTTP Accept header
  Accept:
    name: Accept
    in: header
    description: |
      Media types acceptable for the response. Default is application/json.
    default: application/json
    type: string

  # Used for pagination:
  # The order number of an instance in a qualified set of resoures
  # at which to start to return the next batch of qualified resources
  offset:
    name: offset
    in: query
    description: |
      Starting point within the complete list of items qualified.
    default: 0
    type: integer

  # The HTTP If-None-Match header
  # Used to avoid retrieving data that are already cached
  If-None-Match:
    name: If-None-Match
    in: header
    description: |
      Validator for conditional requests; based on the ETag of the formerly retrieved
      variant of the resource.
    type : string
  # The HTTP If-Match header
  # Used to avoid concurrent updates
  If-Match:
    name: If-Match
    in: header
    description: |
      Validator for conditional requests; based on ETag.
    type: string

  # Scope Name
  scopeName:
    name: name
    in: path
    description: |
      Scope name
    required: true
    type: string

  # Specifies whether full details of APIs should be returned on apisGet call
  expand:
    name: expand
    in: query
    description: |
      Defines whether the returned response should contain full details of API
    type: boolean
  #Threat protection policy ID parameter
  threatProtectionPolicyId:
    name: policyId
    in: path
    description: |
      The UUID of a Policy
    required: true
    type: string

  # Role ID
  roleId:
    name: roleId
    in: path
    description: |
      The Base 64 URL encoded role name with domain. If the given role is in secondary user-store, role ID should be
      derived as Base64URLEncode({user-store-name}/{role-name}). If the given role is in PRIMARY user-store, role ID
      can be derived as Base64URLEncode(role-name)
    required: true
    type: string

  #Threat Protection policy
  threatProtectionPolicy:
    name: threatProtectionPolicy
    in: body
    description: |
      Threat protection policy request parameter
    required: true
    schema: {
      $ref: '#/definitions/ThreatProtectionPolicy'
    }

  # Requested Tenant domain
  # Specified as a header parameter
  requestedTenant:
    name: X-WSO2-Tenant
    in: header
    description: |
      For cross-tenant invocations, this is used to specify the tenant domain, where the resource need to be
        retirieved from.
    required: false
    type: string

  # API Identifier
  # Specified as part of the path expression
  apiProductId:
    name: apiProductId
    in: path
    description: |
      **API Product ID** consisting of the **UUID** of the API Product. Using the **UUID** in the API call is recommended.
    required: true
    type: string
    x-encoded: true

  # Tenant Domain
  tenantDomain:
    name: tenantDomain
    in: path
    description: |
      The domain of a specific tenant
    required: true
    type: string

  # The alertType parameter
  alertType:
    name: alertType
    in: path
    type: string
    required: true
    description: The alert type.

  # The alert subscription id parameter
  configurationId:
    name: configurationId
    type: string
    in: path
    required: true
    description: The alert configuration id.
######################################################
# The resources used by some of the APIs above within the message body
######################################################
definitions:

  #-----------------------------------------------------
  # The API List resource
  #-----------------------------------------------------
  APIList:
    title: API List
    properties:
      count:
        type: integer
        description: |
          Number of APIs returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/APIInfo'
      pagination:
        $ref: '#/definitions/Pagination'
        # example:
        #   next: "/apis?limit=1&offset=2&query="
        #   previous: "/apis?limit=1&offset=0&query="

  #-----------------------------------------------------
  # The API List resource
  #-----------------------------------------------------
  APIListExpanded:
    title: API List
    properties:
      count:
        type: integer
        description: |
          Number of APIs returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/API'
      pagination:
        $ref: '#/definitions/Pagination'
        # example:
        #   next: "/apis?limit=1&offset=2&query="
        #   previous: "/apis?limit=1&offset=0&query="

  #-----------------------------------------------------
  # The API Info resource
  #-----------------------------------------------------
  APIInfo:
    title: API Info object with basic API details.
    properties:
      id:
        type: string
        example: 01234567-0123-0123-0123-012345678901
      name:
        type: string
        example: CalculatorAPI
      description:
        type: string
        example: A calculator API that supports basic operations
      context:
        type: string
        example: CalculatorAPI
      version:
        type: string
        example: 1.0.0
      provider:
        description: |
          If the provider value is not given, the user invoking the API will be used as the provider.
        type: string
        example: admin
      type:
        type: string
        example: HTTP
      lifeCycleStatus:
        type: string
        example: CREATED
      workflowStatus:
        type: string
        example: APPROVED
      hasThumbnail:
        type: boolean
        example: true
      securityScheme:
        type: array
        items:
          type: string

  #-----------------------------------------------------
  # The API resource
  #-----------------------------------------------------
  API:
    title: API object
    required:
      - name
      - context
      - version
    x-scopes:
      - apim:api_create
    properties:
      id:
        type: string
        description: |
          UUID of the api registry artifact
        example: 01234567-0123-0123-0123-012345678901
      name:
        type: string
        example: CalculatorAPI
      description:
        type: string
        example: A calculator API that supports basic operations
      context:
        type: string
        example: CalculatorAPI
      version:
        type: string
        example: 1.0.0
      provider:
        description: |
          If the provider value is not given user invoking the api will be used as the provider.
        type: string
        example: admin
      lifeCycleStatus:  # NEED TO RENAME AS lifeCycleState
        type: string
        example: CREATED
      wsdlInfo:
        description: WSDL information of the API. This is only available if the API is a SOAP API.
        properties:
          type:
            type: string
            description: Indicates whether the WSDL is a single WSDL or an archive in ZIP format
            enum:
              - WSDL
              - ZIP
      responseCachingEnabled:
        type: boolean
        example: true
      cacheTimeout:
        type: integer
        example: 300
      destinationStatsEnabled:
        type: string
        example: Disabled
      hasThumbnail:
        type: boolean
        example: true
      isDefaultVersion:
        type: boolean
        example: false
      enableSchemaValidation:
        type: boolean
        example: false
      type:
        type: string
        description: The api creation type to be used. Accepted values are HTTP, WS, SOAPTOREST, GRAPHQL
        enum:
          - HTTP
          - WS
          - SOAPTOREST
          - SOAP
          - GRAPHQL
        example: HTTP
        default: HTTP
      transport:
        description: |
          Supported transports for the API (http and/or https).
        type: array
        items:
          type: string
        example: ["http","https"]
      tags:
        type: array
        items:
          type: string
        example: ["substract","add"]
        x-otherScopes:
          - apim:api_publish
      policies:
        type: array
        items:
          type: string
        example: ["Unlimited"]
        x-otherScopes:
          - apim:api_publish
      apiThrottlingPolicy:
        description: The API level throttling policy selected for the particular API
        type: string
        example: "Unlimited"
        x-otherScopes:
          - apim:api_publish
      authorizationHeader:
        type: string
        description: |
          Name of the Authorization header used for invoking the API. If it is not set, Authorization header name specified
          in tenant or system level will be used.
      securityScheme:
        type: array
        description: |
          Types of API security, the current API secured with. It can be either OAuth2 or mutual SSL or both. If
          it is not set OAuth2 will be set as the security for the current API.
        items:
          type: string
      maxTps:
        $ref: '#/definitions/APIMaxTps'
      visibility:
        type: string
        description: The visibility level of the API. Accepts one of the following. PUBLIC, PRIVATE, RESTRICTED.
        enum:
          - PUBLIC
          - PRIVATE
          - RESTRICTED
        example: PUBLIC
        default: PUBLIC
        x-otherScopes:
          - apim:api_publish
      visibleRoles:
        type: array
        description: The user roles that are able to access the API in Store
        items:
          type: string
        example: []
        x-otherScopes:
          - apim:api_publish
      visibleTenants:
        type: array
        items:
          type: string
      endpointSecurity:
        $ref: '#/definitions/APIEndpointSecurity'
      gatewayEnvironments:
        description: |
          List of gateway environments the API is available
        type: array
        items:
          type: string
        example: ["Production and Sandbox"]
        x-otherScopes:
          - apim:api_publish
      labels:
        description: |
          Labels of micro-gateway environments attached to the API.
        type: array
        items:
          type: string
          example: ["Pizzashack, Petstore"]
      mediationPolicies:
        type: array
        items:
          $ref: '#/definitions/MediationPolicy'
        example: "\"mediationPolicies\":
          [
            {\"name\": \"json_to_xml_in_message\",\"type\": \"in\"},
            {\"name\": \"xml_to_json_out_message\",\"type\": \"out\"},
            {\"name\": \"json_fault\",\"type\": \"fault\"}
          ],"
      subscriptionAvailability:
        type: string
        description: The subscription availability. Accepts one of the following. CURRENT_TENANT, ALL_TENANTS or SPECIFIC_TENANTS.
        enum:
          - CURRENT_TENANT
          - ALL_TENANTS
          - SPECIFIC_TENANTS
        example: CURRENT_TENANT
        default: ALL_TENANTS
        x-otherScopes:
          - apim:api_publish
      subscriptionAvailableTenants:
        type: array
        items:
          type: string
        example: ["tenant1", "tenant2"]
      additionalProperties:
        type: object
        additionalProperties:
          type: string
        description : Map of custom properties of API
        x-otherScopes:
          - apim:api_publish
      monetization:
        $ref: '#/definitions/APIMonetizationInfo'
      accessControl:
        type: string
        description: |
          Is the API is restricted to certain set of publishers or creators or is it visible to all the
          publishers and creators. If the accessControl restriction is none, this API can be modified by all the
          publishers and creators, if not it can only be viewable/modifiable by certain set of publishers and creators,
           based on the restriction.
        enum:
          - NONE
          - RESTRICTED
        default: NONE
      accessControlRoles:
        type: array
        description: The user roles that are able to view/modify as API publisher or creator.
        items:
          type: string
        example: [admin]
      businessInformation:
        allOf:
          - $ref: '#/definitions/APIBusinessInformation'
        x-otherScopes:
          - apim:api_publish
      corsConfiguration:
        $ref: '#/definitions/APICorsConfiguration'
      workflowStatus:
        type: string
        example: APPROVED
      createdTime:
        type: string
        example: 2017-02-20T13:57:16.229
      lastUpdatedTime:
        type: string
        example: 2017-02-20T13:57:16.229
      endpointConfig:
        type: object
        description: |
          Endpoint configuration of the API. This can be used to provide different types of endpoints including Simple REST Endpoints, Loadbalanced and Failover.

          `Simple REST Endpoint`
            {
              "endpoint_type": "http",
              "sandbox_endpoints":       {
                 "url": "https://localhost:9443/am/sample/pizzashack/v1/api/"
              },
              "production_endpoints":       {
                 "url": "https://localhost:9443/am/sample/pizzashack/v1/api/"
              }
            }

          `Loadbalanced Endpoint`

            {
              "endpoint_type": "load_balance",
              "algoCombo": "org.apache.synapse.endpoints.algorithms.RoundRobin",
              "sessionManagement": "",
              "sandbox_endpoints":       [
                          {
                    "url": "https://localhost:9443/am/sample/pizzashack/v1/api/1"
                 },
                          {
                    "endpoint_type": "http",
                    "template_not_supported": false,
                    "url": "https://localhost:9443/am/sample/pizzashack/v1/api/2"
                 }
              ],
              "production_endpoints":       [
                          {
                    "url": "https://localhost:9443/am/sample/pizzashack/v1/api/3"
                 },
                          {
                    "endpoint_type": "http",
                    "template_not_supported": false,
                    "url": "https://localhost:9443/am/sample/pizzashack/v1/api/4"
                 }
              ],
              "sessionTimeOut": "",
              "algoClassName": "org.apache.synapse.endpoints.algorithms.RoundRobin"
            }

          `Failover Endpoint`

            {
              "production_failovers":[
                 {
                    "endpoint_type":"http",
                    "template_not_supported":false,
                    "url":"https://localhost:9443/am/sample/pizzashack/v1/api/1"
                 }
              ],
              "endpoint_type":"failover",
              "sandbox_endpoints":{
                 "url":"https://localhost:9443/am/sample/pizzashack/v1/api/2"
              },
              "production_endpoints":{
                 "url":"https://localhost:9443/am/sample/pizzashack/v1/api/3"
              },
              "sandbox_failovers":[
                 {
                    "endpoint_type":"http",
                    "template_not_supported":false,
                    "url":"https://localhost:9443/am/sample/pizzashack/v1/api/4"
                 }
              ]
            }

          `Default Endpoint`

            {
              "endpoint_type":"default",
              "sandbox_endpoints":{
                 "url":"default"
              },
              "production_endpoints":{
                 "url":"default"
              }
            }

        example:
          {
            "endpoint_type": "http",
            "sandbox_endpoints":       {
              "url": "https://localhost:9443/am/sample/pizzashack/v1/api/"
            },
            "production_endpoints":       {
              "url": "https://localhost:9443/am/sample/pizzashack/v1/api/"
            }
          }
      endpointImplementationType:
        type: string
        example: INLINE
        enum:
          - INLINE
          - ENDPOINT
        default: ENDPOINT
      scopes:
        type: array
        items:
          $ref: '#/definitions/Scope'
      operations:
        type: array
        items:
          $ref: '#/definitions/APIOperations'
      threatProtectionPolicies:
        properties:
          list:
            type: array
            items:
              properties:
                policyId:
                  type: string
                priority:
                  type: integer

  #-----------------------------------------------------
  # The Audit Report resource
  #-----------------------------------------------------
  AuditReport:
    title: Resource for Audit Report
    properties:
      report:
        type: string
        description: |
          The API Security Audit Report
      grade:
        type: string
        description: |
          The overall grade of the Security Audit
        example: "27.95"
      numErrors:
        type: integer
        description: |
          The number of errors in the API Definition
        example: 20

  #-----------------------------------------------------
  # The API Product List resource
  #-----------------------------------------------------
  APIProductList:
    title: API Product List
    properties:
      count:
        type: integer
        description: |
          Number of API Products returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/APIProductInfo'
      pagination:
        $ref: '#/definitions/Pagination'

  #-----------------------------------------------------
  # The API Product Info resource
  #-----------------------------------------------------
  APIProductInfo:
    title: API Info object with basic API details.
    properties:
      id:
        type: string
        description: |
          UUID of the api product
        example: 01234567-0123-0123-0123-012345678901
      name:
        type: string
        description: Name of the API Product
        example: CalculatorAPIProduct
      context:
        type: string
        example: CalculatorAPI
      description:
        type: string
        description: A brief description about the API
        example: A calculator API Product that supports basic operations
      provider:
        description: |
          If the provider value is not given, the user invoking the API will be used as the provider.
        type: string
        example: admin
      hasThumbnail:
        type: boolean
        example: true
      state:
        type: string
        description: |
          State of the API product. Only published api products are visible on the store
        enum:
          - CREATED
          - PUBLISHED
      securityScheme:
        type: array
        description: |
          Types of API security, the current API secured with. It can be either OAuth2 or mutual SSL or both. If
          it is not set OAuth2 will be set as the security for the current API.
        items:
          type: string

  #-----------------------------------------------------
  # The Detailed API Product resource
  #-----------------------------------------------------
  APIProduct:
    title: API Product object
    required:
      - name
    properties:
      id:
        type: string
        description: |
          UUID of the api product
        example: 01234567-0123-0123-0123-012345678901
      name:
        type: string
        description: Name of the API Product
        example: CalculatorAPIProduct
      context:
        type: string
        example: CalculatorAPI
      description:
        type: string
        description: A brief description about the API
        example: A calculator API Product that supports basic operations
      provider:
        description: |
          If the provider value is not given, the user invoking the API will be used as the provider.
        type: string
        example: admin
      hasThumbnail:
        type: boolean
        example: true
      state:
        type: string
        description: |
          State of the API product. Only published api products are visible on the store
        enum:
          - CREATED
          - PUBLISHED
      enableSchemaValidation:
        type: boolean
        example: false
      responseCachingEnabled:
        type: boolean
        example: true
      cacheTimeout:
        type: integer
        example: 300
      visibility:
        type: string
        description: The visibility level of the API. Accepts one of the following. PUBLIC, PRIVATE, RESTRICTED.
        enum:
          - PUBLIC
          - PRIVATE
          - RESTRICTED
        example: PUBLIC
        default: PUBLIC
      visibleRoles:
        type: array
        description: The user roles that are able to access the API
        items:
          type: string
        example: []
      visibleTenants:
        type: array
        items:
          type: string
      accessControl:
        type: string
        description: |
          Defines whether the API Product is restricted to certain set of publishers or creators or is it visible to all the
          publishers and creators. If the accessControl restriction is none, this API Product can be modified by all the
          publishers and creators, if not it can only be viewable/modifiable by certain set of publishers and creators,
          based on the restriction.
        enum:
          - NONE
          - RESTRICTED
        default: NONE
      accessControlRoles:
        type: array
        description: The user roles that are able to view/modify as API Product publisher or creator.
        items:
          type: string
        example: [admin]
      gatewayEnvironments:
        description: |
          List of gateway environments the API Product is available
        type: array
        items:
          type: string
        example: ["Production and Sandbox"]
      apiType:
        type: string
        description: The api type to be used. Accepted values are API, API PRODUCT
        example: APIProduct
      transport:
        description: |
          Supported transports for the API (http and/or https).
        type: array
        items:
          type: string
        example: ["http","https"]
      tags:
        type: array
        items:
          type: string
        example: ["substract","add"]
      policies:
        type: array
        items:
          type: string
        example: ["Unlimited"]
      apiThrottlingPolicy:
         description: The API level throttling policy selected for the particular API Product
         type: string
         example: "Unlimited"
      authorizationHeader:
        type: string
        description: |
          Name of the Authorization header used for invoking the API. If it is not set, Authorization header name specified
          in tenant or system level will be used.
      securityScheme:
        type: array
        description: |
          Types of API security, the current API secured with. It can be either OAuth2 or mutual SSL or both. If
          it is not set OAuth2 will be set as the security for the current API.
        items:
          type: string
      subscriptionAvailability:
        type: string
        description: The subscription availability. Accepts one of the following. CURRENT_TENANT, ALL_TENANTS or SPECIFIC_TENANTS.
        enum:
          - CURRENT_TENANT
          - ALL_TENANTS
          - SPECIFIC_TENANTS
        example: CURRENT_TENANT
      subscriptionAvailableTenants:
        type: array
        items:
          type: string
        example: ["tenant1", "tenant2"]
        x-otherScopes:
          - apim:api_publish
      additionalProperties:
        type: object
        additionalProperties:
          type: string
        description : Map of custom properties of API
      monetization:
        $ref: '#/definitions/APIMonetizationInfo'
      businessInformation:
        $ref: '#/definitions/APIProductBusinessInformation'
      corsConfiguration:
        $ref: '#/definitions/APICorsConfiguration'
      createdTime:
        type: string
        example: 2017-02-20T13:57:16.229
      lastUpdatedTime:
        type: string
        example: 2017-02-20T13:57:16.229
      apis:
        description: |
          APIs and resources in the API Product.
        type: array
        items:
          $ref: '#/definitions/ProductAPI'
      scopes:
        type: array
        items:
          $ref: '#/definitions/Scope'
  #-----------------------------------------------------
  # The API and its resources in a API Product resource
  #-----------------------------------------------------
  ProductAPI:
    title: ProductAPI
    required:
      - apiId
    properties:
      name:
        type: string
        example: CalculatorAPI
      apiId:
        type: string
        example: 01234567-0123-0123-0123-012345678901
      operations:
        type: array
        items:
          $ref: '#/definitions/APIOperations'

  #-----------------------------------------------------
  # The Resource Path resource
  #-----------------------------------------------------
  ResourcePath:
    title: ResourcePath
    required:
      - id
    properties:
      id:
        type: integer
        example: 1
      resourcePath:
        type: string
        example: /menu
      httpVerb:
        type: string
        example: GET

  #-----------------------------------------------------
  # The Resource Path List resource
  #-----------------------------------------------------
  ResourcePathList:
    title: ResourcePath List
    properties:
      count:
        type: integer
        description: |
          Number of API Resource Paths returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/ResourcePath'
      pagination:
        $ref: '#/definitions/Pagination'

  #-----------------------------------------------------
  # The APIProduct outdated status resource
  #-----------------------------------------------------
  APIProductOutdatedStatus:
    title: APIProduct is outdated status
    properties:
      isOutdated:
        type: boolean
        description: |
          Indicates if an API Product is outdated
        example: true

  #-----------------------------------------------------
  # API Business Information resource
  #-----------------------------------------------------
  APIProductBusinessInformation:
    properties:
      businessOwner:
        type: string
        example: businessowner
      businessOwnerEmail:
        type: string
        example: businessowner@wso2.com
      technicalOwner:
        type: string
        example: technicalowner
      technicalOwnerEmail:
        type: string
        example: technicalowner@wso2.com

  #-----------------------------------------------------
  # The Application resource
  #-----------------------------------------------------
  Application:
    title: Application
    required:
      - name
      - throttlingTier
    properties:
      applicationId:
        type: string
        example: 01234567-0123-0123-0123-012345678901
      name:
        type: string
        example: CalculatorApp
      subscriber:
        type: string
        example: admin
      throttlingTier:
        type: string
        example: Unlimited
      description:
        type: string
        example: Sample calculator application
      groupId:
        type: string
        example: ""
  #-----------------------------------------------------
  # The Application Info resource
  #-----------------------------------------------------
  ApplicationInfo:
    title: Application info object with basic application details
    properties:
      applicationId:
        type: string
        example: 01234567-0123-0123-0123-012345678901
      name:
        type: string
        example: CalculatorApp
      subscriber:
        type: string
        example: admin
      description:
        type: string
        example: Sample calculator application
      subscriptionCount:
        type: integer

  #-----------------------------------------------------
  # The Document List resource
  #-----------------------------------------------------
  DocumentList:
    title: Document List
    properties:
      count:
        type: integer
        description: |
          Number of Documents returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/Document'
      pagination:
        $ref: '#/definitions/Pagination'
        # example:
        #   next: "/apis/01234567-0123-0123-0123-012345678901/documents?limit=1&offset=2"
        #   previous: "/apis/01234567-0123-0123-0123-012345678901/documents?limit=1&offset=0"

  #-----------------------------------------------------
  # The Document resource
  #-----------------------------------------------------
  Document:
    title: Document
    required:
      - name
      - type
      - sourceType
      - visibility
    properties:
      documentId:
        type: string
        example: 01234567-0123-0123-0123-012345678901
      name:
        type: string
        example: CalculatorDoc
      type:
        type: string
        enum:
          - HOWTO
          - SAMPLES
          - PUBLIC_FORUM
          - SUPPORT_FORUM
          - API_MESSAGE_FORMAT
          - SWAGGER_DOC
          - OTHER
        example: HOWTO
      summary:
        type: string
        example: "Summary of Calculator Documentation"
      sourceType:
        type: string
        enum:
          - INLINE
          - MARKDOWN
          - URL
          - FILE
        example: INLINE
      sourceUrl:
        type: string
        example: ""
      fileName:
        type: string
        example: ""
      inlineContent:
        type: string
        example: "This is doc content. This can have many lines."
      otherTypeName:
        type: string
        example: ""
      visibility:
        type: string
        enum:
          - OWNER_ONLY
          - PRIVATE
          - API_LEVEL
        example: API_LEVEL
      createdTime:
        type: string
        example: 2017-02-20T13:57:16.229
      createdBy:
        type: string
      lastUpdatedTime:
        type: string
        example: 2017-02-20T13:57:16.229
      lastUpdatedBy:
        type: string

  #-----------------------------------------------------
  # The GraphQL Schema resource
  #-----------------------------------------------------
  GraphQLSchema:
    title: GraphQL Schema
    required:
      - name
    properties:
      name:
        type: string
        example: "admin--HackerNewsAPI.graphql"
      schemaDefinition:
        type: string


  #-----------------------------------------------------
  # The Mediation List resource
  #-----------------------------------------------------
  MediationList:
    title: Mediation List
    properties:
      count:
        type: integer
        description: |
          Number of mediation sequences returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/MediationInfo'
      pagination:
        $ref: '#/definitions/Pagination'

  #-----------------------------------------------------
  # The MediationInfo resource
  #-----------------------------------------------------
  MediationInfo:
    title: MediationInfo
    required:
      - name
      - type
      - id
    properties:
      name:
        type: string
        example: json_fault.xml
      id:
        type: string
        example: 01234567-0123-0123-0123-012345678901
      type:
        type: string
        enum:
          - in
          - out
          - fault
        example: in

  #-----------------------------------------------------
  # The Mediation resource
  #-----------------------------------------------------
  Mediation:
    title: Mediation
    required:
      - name
      - type
    properties:
      id:
        type: string
        example: 01234567-0123-0123-0123-012345678901
      name:
        type: string
        example: json_fault.xml
      type:
        type: string
        enum:
          - in
          - out
          - fault
        example: in

  #-----------------------------------------------------
  # The Tier List resource
  #-----------------------------------------------------
  ThrottlingPolicyList:
    title: Throttling policy list
    properties:
      count:
        type: integer
        description: |
          Number of Tiers returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/ThrottlingPolicy'
      pagination:
        $ref: '#/definitions/Pagination'
        # example:
        #   next: "/throttling-policies/subscription?limit=1&offset=2"
        #   previous: "/throttling-policies/subscription?limit=1&offset=0"

  #-----------------------------------------------------
  # The Tier resource
  #-----------------------------------------------------
  ThrottlingPolicy:
    title: Tier
    required:
      - name
      - tierPlan
      - requestCount
      - unitTime
      - stopOnQuotaReach
    properties:
      name:
        type: string
        example: Platinum
      description:
        type: string
        example: "Allows 50 request(s) per minute."
      policyLevel:
        type: string
        enum:
          - subscription
          - api
        example: api
      displayName:
        type: string
        example: Platinum
      attributes:
        description: |
          Custom attributes added to the policy policy
        type: object
        additionalProperties:
          type: string
        example: {}
      requestCount:
        description: |
          Maximum number of requests which can be sent within a provided unit time
        type: integer
        format: int64
        example: 50
      unitTime:
        type: integer
        format: int64
        example: 60000
      timeUnit:
        type: string
        example: "min"
      tierPlan:
        description: |
          This attribute declares whether this policy is available under commercial or free
        type: string
        enum:
          - FREE
          - COMMERCIAL
        example: FREE
      stopOnQuotaReach:
        description: |
          By making this attribute to false, you are capabale of sending requests
          even if the request count exceeded within a unit time
        type: boolean
        example: true
      monetizationProperties:
        description:
          Properties of a tier plan which are related to monetization
        type: object
        additionalProperties:
          type: string
        example: {}
  #-----------------------------------------------------
  # The Subscription List resource
  #-----------------------------------------------------
  SubscriptionList:
    title: Subscription List
    properties:
      count:
        type: integer
        description: |
          Number of Subscriptions returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/Subscription'
      pagination:
        $ref: '#/definitions/Pagination'
        # example:
        #   next: "/subscriptions?limit=1&offset=2&apiId=01234567-0123-0123-0123-012345678901"
        #   previous: "/subscriptions?limit=1&offset=0&apiId=01234567-0123-0123-0123-012345678901"

  #-----------------------------------------------------
  # The Subscription resource
  #-----------------------------------------------------
  Subscription:
    title: Subscription
    required:
      - subscriptionId
      - applicationInfo
      - throttlingPolicy
      - subscriptionStatus
    properties:
      subscriptionId:
        type: string
        example: 01234567-0123-0123-0123-012345678901
      applicationInfo:
        $ref: '#/definitions/ApplicationInfo'
      throttlingPolicy:
        type: string
        example: Unlimited
      subscriptionStatus:
        type: string
        enum:
          - BLOCKED
          - PROD_ONLY_BLOCKED
          - UNBLOCKED
          - ON_HOLD
          - REJECTED
        example: BLOCKED

  #-----------------------------------------------------
  # The API monetization usage resource
  #-----------------------------------------------------
  APIMonetizationUsage:
    title: API monetization usage object
    properties:
      properties:
        type: object
        description: Map of custom properties related to monetization usage
        additionalProperties:
          type: string

  #-----------------------------------------------------
  # The API revenue resource
  #-----------------------------------------------------
  APIRevenue:
    title: API revenue data object
    properties:
      properties:
        type: object
        description: Map of custom properties related to API revenue
        additionalProperties:
          type: string

  #-----------------------------------------------------
  # The Mediation Policy resource
  #-----------------------------------------------------
  MediationPolicy:
    title: Mediation Policy
    required:
      - name
    properties:
      id:
        type: string
        example: 69ea3fa6-55c6-472e-896d-e449dd34a824
      name:
        type: string
        example: log_in_message
      type:
        type: string
        example: in
      shared:
        type: boolean
        example: true

  #-----------------------------------------------------
  # The Error resource
  #-----------------------------------------------------
  Error:
    title: Error object returned with 4XX HTTP Status
    required:
      - code
      - message
    properties:
      code:
        type: integer
        format: int64
      message:
        type: string
        description: Error message.
      description:
        type: string
        description: |
          A detail description about the error message.
      moreInfo:
        type: string
        description: |
          Preferably an url with more details about the error.
      error:
        type: array
        description: |
          If there are more than one error list them out.
          For example, list out validation errors by each field.
        items:
          $ref: '#/definitions/ErrorListItem'

  #-----------------------------------------------------
  # The Error List Item resource
  #-----------------------------------------------------
  ErrorListItem:
    title: Description of individual errors that may have occurred during a request.
    required:
      - code
      - message
    properties:
      code:
        type: string
      message:
        type: string
        description: |
          Description about individual errors occurred
      description:
        type: string
        description: |
          A detail description about the error message.

  #-----------------------------------------------------
  # The Environment resource
  #-----------------------------------------------------
  Environment:
    title: Environment
    required:
      - name
      - type
      - serverUrl
      - endpoints
      - showInApiConsole
    properties:
      name:
        type: string
        example: Production and Sandbox
      type:
        type: string
        example: hybrid
      serverUrl:
        type: string
        example: "https://localhost:9443/services/"
      showInApiConsole:
        type: boolean
        example: true
      endpoints:
        $ref: '#/definitions/EnvironmentEndpoints'

  #-----------------------------------------------------
  # The Environment List resource
  #-----------------------------------------------------
  EnvironmentList:
    title: Environment List
    properties:
      count:
        type: integer
        description: |
          Number of Environments returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/Environment'


  #-----------------------------------------------------
  # The Environment Endpoint resource
  #-----------------------------------------------------
  EnvironmentEndpoints :
    title: Environment Endpoints
    properties:
      http:
        type: string
        description: HTTP environment URL
        example: "http://localhost:8280"
      https:
        type: string
        description: HTTPS environment URL
        example: "https://localhost:8243"
      ws:
        type: string
        description: WS environment URL
        example: "http://localhost:9099"
      wss:
        type: string
        description: WSS environment URL
        example: "https://localhost:8099"

  #-----------------------------------------------------
  # The File Information resource
  #-----------------------------------------------------
  FileInfo :
    title: File Information including meta data
    properties:
      relativePath:
        type: string
        description: relative location of the file (excluding the base context and host of the Publisher API)
        example: "apis/01234567-0123-0123-0123-012345678901/thumbnail"
      mediaType:
        type: string
        description: media-type of the file
        example: "image/jpeg"


  #-----------------------------------------------------
  # API maxTPs resource
  #-----------------------------------------------------
  APIMaxTps:
    properties:
      production:
        type: integer
        format: int64
        example: 1000
      sandbox:
        type: integer
        format: int64
        example: 1000

  #-----------------------------------------------------
  # API Endpoint Security resource
  #-----------------------------------------------------
  APIEndpointSecurity:
    properties:
      type:
        type: string
        example: basic
        description: Accepts one of the following, basic or digest.
        enum:
          - BASIC
          - DIGEST
      username:
        type: string
        example: admin
      password:
        type: string
        example: password

  #-----------------------------------------------------
  # API Business Information resource
  #-----------------------------------------------------
  APIBusinessInformation:
    properties:
      businessOwner:
        type: string
        example: businessowner
      businessOwnerEmail:
        type: string
        example: businessowner@wso2.com
      technicalOwner:
        type: string
        example: technicalowner
      technicalOwnerEmail:
        type: string
        example: technicalowner@wso2.com

  #-----------------------------------------------------
  # API CORS configuration resource
  #-----------------------------------------------------
  APICorsConfiguration:
    description: |
      CORS configuration for the API
    properties:
      corsConfigurationEnabled:
        type: boolean
        default: false
      accessControlAllowOrigins:
        type: array
        items:
          type: string
      accessControlAllowCredentials:
        type: boolean
        default: false
      accessControlAllowHeaders:
        type: array
        items:
          type: string
      accessControlAllowMethods:
        type: array
        items:
          type: string
  #-----------------------------------------------------
  # The Environment Endpoint resource
  #-----------------------------------------------------
  Endpoint :
    title: Endpoints
    properties:
      id:
        type: string
        description: |
          UUID of the Endpoint entry
        example: 01234567-0123-0123-0123-012345678901
      name:
        type: string
        description: |
          name of the Endpoint entry
        example: "Endpoint 1"
      endpointConfig:
        properties:
          endpointType:
            type: string
            enum:
              - SINGLE
              - LOAD_BALANCED
              - FAIL_OVER
            example: "FAIL_OVER"
          list:
            type: array
            items:
              $ref: '#/definitions/EndpointConfig'
      endpointSecurity:
        properties:
          enabled:
            type: boolean
            example: false
          type:
            type: string
            example: basic
          username:
            type: string
            example: basic
          password:
            type: string
            example: basic
      maxTps:
        type: integer
        format: int64
        description: Endpoint max tps
        example: 1000
      type:
        type: string
        example: "http"

  #-----------------------------------------------------
  # The Endpoint Configuration resource
  #-----------------------------------------------------
  EndpointConfig :
    title: Endpoint Configuration
    properties:
      url:
        type: string
        description: |
          Service url of the endpoint
        example: "http://localhost:8280"
      timeout:
        type: string
        description: |
          Time out of the endpoint
        example: "1000"
      attributes:
        type: array
        items:
          properties:
            name:
              type: string
              example: "Suspension time"
            value:
              type: string
              example: "2s"

  #-----------------------------------------------------
  # The Environment List resource
  #-----------------------------------------------------
  EndpointList:
    title: Endpoint List
    properties:
      count:
        type: integer
        description: |
          Number of Endpoints returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/Endpoint'

  #-----------------------------------------------------
  # The Environment Endpoint resource
  #-----------------------------------------------------
  Scope :
    title: Scope
    properties:
      name:
        type: string
        description: |
          name of Scope
        example: apim:api_view
      description:
        type: string
        description: |
          description of Scope
        example: 'This Scope can used to view Apis'
      bindings:
        properties:
          type:
            type: string
            description: |
              Type of binding role / permission
          values:
            type: array
            items:
              type: string

  APIOperations :
    title: Operation
    properties:
      id:
        type: string
        example: "postapiresource"
      target:
        type: string
      verb:
        type: string
      authType:
        type: string
        default: "Any"
      throttlingPolicy:
        type: string
        example: "Unlimited"
      scopes:
        type: array
        items:
          type: string
      usedProductIds:
        type: array
        items:
          type: string


#-----------------------------------------------------
# The Scope List resource
#-----------------------------------------------------
  ScopeList:
    title: Scope List
    properties:
      count:
        type: integer
        description: |
          Number of Scopes returned.
        example: 1
      list:
        type: array
        items:
          properties:
            name:
              type: string
              example: "apim:api_view"
            description:
              type: string
              example: "Scope for Api view"

  #-----------------------------------------------------
  # The External-Store resource
  #-----------------------------------------------------
  ExternalStore:
    title: External Store
    properties:
      id:
        type: string
        description: |
          The external store identifier, which is a unique value.
        example: Store123#
      displayName:
        type: string
        description: |
          The name of the external API Store that is displayed in the Publisher UI.
        example: UKStore
      type:
        type: string
        description: |
          The type of the Store. This can be a WSO2-specific API Store or an external one.
        example: wso2
      endpoint:
        type: string
        description: |
          The endpoint URL of the external store
        example: http://localhost:9764/store

  #-----------------------------------------------------
  # The API-External-Store resource
  #-----------------------------------------------------
  APIExternalStore:
    title: API External Store
    properties:
      id:
        type: string
        description: |
          The external store identifier, which is a unique value.
        example: Store123#
      lastUpdatedTime:
        description: |
          The recent timestamp which a given API is updated in the external store.
        type: string
        example: 2019-09-09T13:57:16.229

  #-----------------------------------------------------
  # The API-External-Store List resource
  #-----------------------------------------------------
  APIExternalStoreList:
    title: API External Store List
    properties:
      count:
        type: integer
        description: |
          Number of external stores returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/APIExternalStore'

  #-----------------------------------------------------
  # The External-Store List resource
  #-----------------------------------------------------
  ExternalStoreList:
    title: External Store List
    properties:
      count:
        type: integer
        description: |
          Number of external stores returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/ExternalStore'

  #-----------------------------------------------------
  # Certificates list resource
  #-----------------------------------------------------
  Certificates:
    title: Certificates
    description: Representation of a list of certificates
    properties:
      count:
        type: integer
        example: 1
      certificates:
        type: array
        items:
          $ref: '#/definitions/CertMetadata'
      pagination:
        $ref: '#/definitions/Pagination'
        # example:
        #   next: "/endpoint-certificates?limit=1&offset=2"
        #   previous: "/endpoint-certificates?limit=1&offset=0"

  #-----------------------------------------------------
  # Certificate metadata resource
  #-----------------------------------------------------
  CertMetadata:
    title: Certificate
    description: Representation of the details of a certificate
    properties:
      alias:
        type: string
        example: wso2carbon
      endpoint:
        type: string
        example: www.abc.com

  #-----------------------------------------------------
  # Certificates information resource
  #-----------------------------------------------------
  CertificateInfo:
    title: Certificate information
    properties:
      status:
        type: string
        example: Active
      validity:
        $ref: '#/definitions/CertificateValidity'
      version:
        type: string
        example: V3
      subject:
        type: string
        example: CN=wso2.com, OU=wso2, O=wso2, L=Colombo, ST=Western, C=LK

  #-----------------------------------------------------
  # Certificate validity period resource
  #-----------------------------------------------------
  CertificateValidity:
    title: Certificate Valid period
    properties:
      from:
        type: string
        example: 12-12-2017
      to:
        type: string
        example: 01-01-2019

  #-----------------------------------------------------
  # Client Certificates list resource
  #-----------------------------------------------------
  ClientCertificates:
    title: Client Certificates
    description: Representation of a list of client certificates
    properties:
      count:
        type: integer
        example: 1
      certificates:
        type: array
        items:
          $ref: '#/definitions/ClientCertMetadata'
      pagination:
        $ref: '#/definitions/Pagination'
        # example:
        #   next: "/client-certificates?limit=1&offset=2"
        #   previous: "/client-certificates?limit=1&offset=0"

  #-----------------------------------------------------
  # Certificate metadata resource
  #-----------------------------------------------------
  ClientCertMetadata:
    title: Client certificate meta data
    description: Meta data of certificate
    properties:
      alias:
        type: string
        example: wso2carbon
      apiId:
        type: string
        example: 64eca60b-2e55-4c38-8603-e9e6bad7d809
      tier:
        type: string
        example: Gold

  #-----------------------------------------------------
  # The Label resource
  #-----------------------------------------------------
  Label:
    title: Label
    required:
      - name
    properties:
      name:
        type: string
      description:
        type: string
      access_urls:
        type: array
        items:
          type: string

  #-----------------------------------------------------
  # The Label List resource
  #-----------------------------------------------------
  LabelList:
    title: Label List
    properties:
      count:
        type: integer
        description: |
          Number of Labels returned.
      list:
        type: array
        items:
          $ref: '#/definitions/Label'
      pagination:
        $ref: '#/definitions/Pagination'

  #-----------------------------------------------------
  # The Lifecycle state resource
  #-----------------------------------------------------
  LifecycleState:
    title:  Lifecycle State
    properties:
      state:
        type: string
        example: "Created"
      checkItems:
        type: array
        items:
          properties:
            name:
              type: string
              example: "Deprecate old versions after publish the API"
            value:
              type: boolean
              example: false
            requiredStates:
              type: array
              items:
                type: string
      availableTransitions:
        type: array
        items:
          properties:
            event:
              type: string
              example: "Promote"
            targetState:
              type: string
              example: "Created"

  #-----------------------------------------------------
  # The Lifecycle history resource
  #-----------------------------------------------------

  LifecycleHistory:
    title: Lifecycle history item list
    properties:
      count:
        type: integer
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/LifecycleHistoryItem'

  #-----------------------------------------------------
  # The Lifecycle history item resource
  #-----------------------------------------------------

  LifecycleHistoryItem:
    title: Lifecycle history item
    properties:
      previousState:
        type: string
        example: "Created"
      postState:
        type: string
        example: "Published"
      user:
        type: string
        example: "admin"
      updatedTime:
        type: string
        format: dateTime
        example: "2019-02-31T23:59:60Z"


  #-----------------------------------------------------
  # The workflow executor's response resource
  #-----------------------------------------------------
  WorkflowResponse:
    title: workflow Response
    required:
      - workflowStatus
    properties:
      workflowStatus:
        description: |
          This attribute declares whether this workflow task is approved or rejected.
        type: string
        enum:
          - CREATED
          - APPROVED
          - REJECTED
          - REGISTERED
        example: APPROVED
      jsonPayload:
        description: |
          Attributes that returned after the workflow execution
        type: string
      lifecycleState:
        $ref: '#/definitions/LifecycleState'

  #-----------------------------------------------------
  # The OpenAPI Definition Validation Response
  #-----------------------------------------------------
  OpenAPIDefinitionValidationResponse:
    title: OpenAPI Definition Validation Response
    required:
      - isValid
    properties:
      isValid:
        description: |
          This attribute declares whether this definition is valid or not.
        type: boolean
        example: true
      content:
        description: |
          OpenAPI definition content.
        type: string
      info:
        description: |
          API definition information
        properties:
          name:
            type: string
            example: "PetStore"
          version:
            type: string
            example: "1.0.0"
          context:
            type: string
            example: "/petstore"
          description:
            type: string
            example: "A sample API that uses a petstore as an example to demonstrate swagger-2.0 specification"
          openAPIVersion:
            type: string
            example: "3.0.0"
      errors:
        type: array
        description: |
          If there are more than one error list them out.
          For example, list out validation errors by each field.
        items:
          $ref: '#/definitions/ErrorListItem'

  #-----------------------------------------------------
  # The WSDL Definition Validation Response
  #-----------------------------------------------------
  WSDLValidationResponse:
    title: WSDL Definition Validation Response
    required:
      - isValid
    properties:
      isValid:
        description: |
          This attribute declares whether this definition is valid or not.
        type: boolean
        example: true
      errors:
        type: array
        description: |
          If there are more than one error list them out.
          For example, list out validation errors by each field.
        items:
          $ref: '#/definitions/ErrorListItem'
      wsdlInfo:
        description:
          Summary of the WSDL including the basic information
        properties:
          version:
            description: |
              WSDL version
            type: string
            example: "1.1"
          endpoints:
            description: |
              A list of endpoints the service exposes
            type: array
            items:
              properties:
                name:
                  type: string
                  description: "Name of the endpoint"
                  example: "StockQuoteSoap"
                location:
                  type: string
                  description: "Endpoint URL"
                  example: "http://www.webservicex.net/stockquote.asmx"

  GraphQLValidationResponse:
    title: GraphQL API definition validation Response
    required:
      - isValid
      - errorMessage
    properties:
      isValid:
        description: |
          This attribute declares whether this definition is valid or not.
        type: boolean
        example: true
      errorMessage:
        description: |
          This attribute declares the validation error message
        type: string
      graphQLInfo:
        description:
          Summary of the GraphQL including the basic information
        properties:
          operations:
            type: array
            items:
              $ref: '#/definitions/APIOperations'
          graphQLSchema:
            $ref: '#/definitions/GraphQLSchema'

  #-----------------------------------------------------
  # The API Endpoint URL Validation Response Resource
  #-----------------------------------------------------
  ApiEndpointValidationResponse:
    title: API Endpoint url validation response
    required:
      - statusCode
      - statusMessage
    properties:
      statusCode:
        type: integer
        description: HTTP status code
      statusMessage:
        type: string
        description: string
      error:
        type: string
        description: |
          If an error occurs, the error message will be set to this property.
          If not, this will remain null.

  #-----------------------------------------------------
  # The Threat Protection Policy List Resource
  #-----------------------------------------------------
  ThreatProtectionPolicyList:
    title: "Threat Protection Policy List"
    properties:
      list:
        type: array
        items:
          $ref: '#/definitions/ThreatProtectionPolicy'

  #-----------------------------------------------------
  # The Threat Protection Policy resource
  #-----------------------------------------------------
  ThreatProtectionPolicy:
    title: "Threat Protection Policy Schema"
    required:
      - name
      - type
      - policy
    properties:
      uuid:
        type: string
        description: Policy ID
      name:
        type: string
        description: Name of the policy
      type:
        type: string
        description: Type of the policy
      policy:
        type: string
        description: policy as a json string

  #-----------------------------------------------------
  # The Result List resource
  #-----------------------------------------------------
  SearchResultList:
    title: Unified Search Result List
    properties:
      count:
        type: integer
        description: |
          Number of results returned.
        example: 1
      list:
        type: array
        items:
          anyOf:
            - $ref: '#/definitions/APISearchResult'
            - $ref: '#/definitions/APIProductSearchResult'
            - $ref: '#/definitions/DocumentSearchResult'
      pagination:
        $ref: '#/definitions/Pagination'

  SearchResult:
    title: Search Result
    required:
      - "name"
    discriminator: "name"
    properties:
      id:
        type: string
        example: 01234567-0123-0123-0123-012345678901
      name:
        type: string
        example: TestAPI
      type:
        type: string
        enum:
          - DOC
          - API
          - APIProduct
        example: API
      transportType:
        type: string
        description: Accepted values are HTTP, WS, SOAPTOREST, GRAPHQL

  APISearchResult:
    title: API Result
    allOf:
      - $ref: '#/definitions/SearchResult'
      - properties:
          description:
            type: string
            description: A brief description about the API
            example: A calculator API that supports basic operations
          context:
            type: string
            description: A string that represents the context of the user's request
            example: CalculatorAPI
          version:
            type: string
            description: The version of the API
            example: 1.0.0
          provider:
            description: |
              If the provider value is not given, the user invoking the API will be used as the provider.
            type: string
            example: admin
          status:
            type: string
            description: This describes in which status of the lifecycle the API is
            example: CREATED
          thumbnailUri:
            type: string
            example: /apis/01234567-0123-0123-0123-012345678901/thumbnail

  APIProductSearchResult:
    title: API Result
    allOf:
      - $ref: '#/definitions/SearchResult'
      - properties:
          description:
            type: string
            description: A brief description about the API
            example: A calculator API that supports basic operations
          context:
            type: string
            description: A string that represents the context of the user's request
            example: CalculatorAPI
          provider:
            description: |
              If the provider value is not given, the user invoking the API will be used as the provider.
            type: string
            example: admin
          status:
            type: string
            description: This describes in which status of the lifecycle the APIPRODUCT is
            example: PUBLISHED
          thumbnailUri:
            type: string
            example: /apis/01234567-0123-0123-0123-012345678901/thumbnail



  #-----------------------------------------------------
  # The API monetization resource
  #-----------------------------------------------------
  APIMonetizationInfo:
    title: API monetization object
    required:
      - enabled
    properties:
      enabled:
        type: boolean
        description: Flag to indicate the monetization status
        example: true
      properties:
        type: object
        description: Map of custom properties related to monetization
        additionalProperties:
          type: string

  DocumentSearchResult:
    title: Document Result
    allOf:
      - $ref: '#/definitions/SearchResult'
      - properties:
          docType:
            type: string
            enum:
              - HOWTO
              - SAMPLES
              - PUBLIC_FORUM
              - SUPPORT_FORUM
              - API_MESSAGE_FORMAT
              - SWAGGER_DOC
              - OTHER
            example: HOWTO
          summary:
            type: string
            example: "Summary of Calculator Documentation"
          sourceType:
            type: string
            enum:
              - INLINE
              - URL
              - FILE
            example: INLINE
          sourceUrl:
            type: string
            example: ""
          otherTypeName:
            type: string
            example: ""
          visibility:
            type: string
            enum:
              - OWNER_ONLY
              - PRIVATE
              - API_LEVEL
            example: API_LEVEL
          apiName:
            type: string
            description: The name of the associated API
            example: TestAPI
          apiVersion:
            type: string
            description: The version of the associated API
            example: 1.0.0
          apiProvider:
            type: string
            example: admin
          apiUUID:
            type: string
          associatedType:
            type: string
  #-----------------------------------------------------
  # The Resource policy List resource
  #-----------------------------------------------------
  ResourcePolicyList:
    title: Resource policy List
    properties:
      list:
        type: array
        items:
          $ref: '#/definitions/ResourcePolicyInfo'
      count:
        type: integer
        description: |
          Number of policy resources returned.
        example: 1

  #-----------------------------------------------------
  # The Resource Policy Info resource
  #-----------------------------------------------------
  ResourcePolicyInfo:
    title: Resource policy Info object with conversion policy resource details.
    properties:
      id:
        type: string
        description: |
          UUID of the resource policy registry artifact
        example: 01234567-0123-0123-0123-012345678901
      httpVerb:
        type: string
        description: HTTP verb used for the resource path
        example: get
      resourcePath:
        type: string
        description: A string that represents the resource path of the api for the related resource policy
        example: CalculatorAPI
      content:
        type: string
        description: The resource policy content
        example: "<header description=\"SOAPAction\" name=\"SOAPAction\" scope=\"transport\" value=\"http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber\"/>"

  #-----------------------------------------------------
  # The settings resource
  #-----------------------------------------------------
  Settings:
    title: SettingsDTO
    properties:
      storeUrl:
        type: string
        description: Store URL
      environment:
        type: array
        items:
          $ref: '#/definitions/Environment'
      scopes:
        type: array
        items:
          type: string
      monetizationAttributes:
        type: array
        items:
          $ref: '#/definitions/MonetizationAttribute'
      securityAuditProperties:
        type: object
        items:
          type: string
      externalStoresEnabled:
        type: boolean
        description: |
          Is External Stores configuration enabled
        example: true

  #-----------------------------------------------------
  # The SecurityAuditAttribute resource
  #-----------------------------------------------------
  SecurityAuditAttribute:
    title: SecurityAuditAttributeDTO
    properties:
      isGlobal:
        type: boolean
        example: false
      overrideGlobal:
        type: boolean
        example: false
      apiToken:
        type: string
        example: b1267ytf-b7gc-4aee-924d-ece81241efec
      collectionId:
        type: string
        example: 456ef957-5a79-449f-83y3-9027945d3c60
      baseUrl:
        type: string


  #-----------------------------------------------------
  # The pagination resource
  #-----------------------------------------------------
  Pagination:
    title: Pagination
    properties:
      offset:
        type: integer
        example: 0
      limit:
        type: integer
        example: 1
      total:
        type: integer
        example: 10
      next:
        type: string
        description: |
          Link to the next subset of resources qualified.
          Empty if no more resources are to be returned.
      previous:
        type: string
        description: |
          Link to the previous subset of resources qualified.
          Empty if current subset is the first subset returned.
  MonetizationAttribute:
    title: Monetization attribute object
    properties:
      required:
        type: boolean
        description: |
          Is attribute required
        example: true
      name:
        type: string
        description: |
          Name of the attribute
      displayName:
        type: string
        description: |
          Display name of the attribute
      description:
        type: string
        description: |
          Description of the attribute
      hidden:
        type: boolean
        description: |
          Is attribute hidden
      default:
        type: string
        description: |
          Default value of the attribute

  #-----------------------------------------------------
  # The Tenant resource
  #-----------------------------------------------------
  Tenant :
    title: Tenant
    properties:
      domain:
        type: string
        description: tenant domain
        example: "wso2.com"
      status:
        type: string
        description: current status of the tenant active/inactive
        example: "active"
  #-----------------------------------------------------
  # The Tenant List resource
  #-----------------------------------------------------
  TenantList :
    title: Tenant list
    properties:
      count:
        type: integer
        description: |
          Number of tenants returned.
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/Tenant'
      pagination:
        $ref: '#/definitions/Pagination'
  #----------------------------------------------
  # The Alert list resource.
  #----------------------------------------------
  AlertTypesList:
    title: Alert Types List
    properties:
      count:
        type: integer
        description: The number of alerts
        example: 3
      alerts:
        type: array
        items:
          $ref: '#/definitions/AlertType'

  #----------------------------------------------
  # The AlertType resource.
  #----------------------------------------------
  AlertType:
    title: Alert Type
    properties:
      id:
        type: integer
        description: The alert Id
        example: 1
      name:
        type: string
        description: The name of the alert.
        example: "AbnormalRequestTime"
      requireConfiguration:
        type: boolean
        description: Whether the alert type require additional configurations.
        example: true

  #----------------------------------------------
  # The Alert resource.
  #----------------------------------------------
  Alert:
    title: Alert
    properties:
      id:
        type: integer
        description: The alert Id
        example: 1
      name:
        type: string
        description: The name of the alert.
        example: "AbnormalRequestsPerMin"
      configuration:
        type: array
        items:
          $ref: '#/definitions/AlertConfig'

  #-----------------------------------------------
  # The Alert Info resource definition.
  #-----------------------------------------------
  AlertsInfo:
    title: Alerts Info
    properties:
      alerts:
        type: array
        items:
          $ref: '#/definitions/Alert'
      emailList:
        type: array
        items:
          type: string

  #-----------------------------------------------
  # The Alert Info Response resource definition.
  #-----------------------------------------------
  AlertsInfoResponse:
    title: Alerts Info Response
    properties:
      alerts:
        type: array
        items:
          $ref: '#/definitions/Alert'
      emailList:
        type: array
        items:
          type: string
      failedConfigurations:
        type: array
        items:
          $ref: '#/definitions/AlertConfig'

  #-----------------------------------------------
  # The Alert Config List resource definition.
  #-----------------------------------------------
  AlertConfigList:
    title: Alert Configuration List
    properties:
      count:
        type: integer
        example: 1
      list:
        type: array
        items:
          $ref: '#/definitions/AlertConfig'

  #-----------------------------------------------
  # The Alert Config resource definition.
  #-----------------------------------------------
  AlertConfig:
    title: Alert Configuration
    properties:
      configurationId:
        type: string
        description: The alert config subscription id.
        example: UGl6emFTaGFja0FQSSsxLjAuMCtEZWZhdWx0QXBwbGljYXRpb24K
      configuration:
        type: object
        description: The config parameters.
        additionalProperties:
          type: string
        example:
          apiName: 'PizzaShackAPI'
          apiVersion: '1.0.0'
          applicationName: 'DefaultApplication'
          requestConunt: '12'

  #-----------------------------------------------
  # The Alert Config Info resource definition.
  #-----------------------------------------------
  AlertConfigInfo:
    title: Alert Configuration Info
    type: object
    description: The config parameters.
    additionalProperties:
      type: string
    example:
      apiName: 'PizzaShackAPI'
      apiVersion: '1.0.0'
      applicationName: 'DefaultApplication'
      requestConunt: '12'

#-----------------------------------------------------
# END-OF-FILE
#-----------------------------------------------------
