API7 Docs

Generate an OpenAPI specification from services in a gateway group

POST /api/gateway_groups/{gateway_group_id}/services/export

POST /api/gateway_groups/{gateway_group_id}/services/export

Interactive request editor loads with JavaScript.

Authorization

X-API-KEY<token>

In: header

Path Parameters

gateway_group_id*string

Gateway group ID.

Length1 <= length

Query Parameters

scope?string

Scope of the service.

Value in

  • "partial"
  • "all"

Request Body

application/json

Response Body

application/json

application/json

curl -X POST "$API_BASE_URL/api/gateway_groups/86fb9981-d9d2-4555-9df8-91ae92129335/services/export" \  -H "Content-Type: application/json" \  -d '{    "info": {      "title": "Swagger Petstore",      "version": "3.0.1"    }  }'

Successfully exported the service as an OpenAPI specification.

{
  "value": {
    "openapi": "3.0.1",
    "info": {
      "title": "Swagger Petstore",
      "version": "3.0.1",
      "description": "API description."
    },
    "servers": [
      {
        "url": "http://localhost:8080",
        "description": "Localhost test server."
      }
    ],
    "paths": {
      "/anything": {
        "delete": {
          "responses": {
            "default": {
              "description": ""
            }
          },
          "tags": [
            "httpbin"
          ]
        },
        "get": {
          "responses": {
            "default": {
              "description": ""
            }
          },
          "tags": [
            "httpbin"
          ]
        },
        "patch": {
          "responses": {
            "default": {
              "description": ""
            }
          },
          "tags": [
            "httpbin"
          ]
        },
        "post": {
          "responses": {
            "default": {
              "description": ""
            }
          },
          "tags": [
            "httpbin"
          ]
        },
        "put": {
          "responses": {
            "default": {
              "description": ""
            }
          },
          "tags": [
            "httpbin"
          ]
        },
        "trace": {
          "responses": {
            "default": {
              "description": ""
            }
          },
          "tags": [
            "httpbin"
          ]
        }
      }
    }
  }
}
Complete operation details and schema variants

POST /api/gateway_groups/{gateway_group_id}/services/export

Generate an OpenAPI specification from services in a gateway group

Export service definitions from a specific gateway group as an OpenAPI 3.0 specification document.

Required IAM Permission: Action gateway:GetPublishedService, Resource arn:api7:gateway:gatewaygroup/%s/service/*

Parameters

  • gateway_group_id (path, string, required): Gateway group ID.
  • scope (query, string, optional): Scope of the service.

Request body

Content type: application/json

  • service_ids (array, optional): The service ID list.
  • info (object, required): API metadata.
  • info.title (string, required): Title of the exported API definition.
  • info.version (string, required): Version of the exported API definition.
  • info.description (string, optional): Description of the exported API definition.
  • servers (array, optional): An array of one or more base servers in the exported API definition.
  • servers[].url (string, optional): Server URL.
  • servers[].description (string, optional): Server description.

Responses

  • 200: Successfully exported the service as an OpenAPI specification.
  • allOf variant 1
  • value (object, optional): The specific resource.
  • allOf variant 2
  • value (object, optional):
  • value.openapi (string, required): The OpenAPI version.
  • value.info (object, required): API metadata.
  • value.info.title (string, required): Title of the exported API definition.
  • value.info.version (string, required): Version of the exported API definition.
  • value.info.description (string, optional): Description of the exported API definition.
  • value.servers (array, optional): An array of one or more base servers in the exported API definition.
  • value.servers[].url (string, optional): Server URL.
  • value.servers[].description (string, optional): Server description.
  • value.paths (object, required): Endpoint paths and their operations.
  • value.paths.*.get (object, optional):
  • value.paths.*.get.responses (object, optional):
  • value.paths.*.put (object, optional):
  • value.paths.*.put.responses (object, optional):
  • value.paths.*.post (object, optional):
  • value.paths.*.post.responses (object, optional):
  • value.paths.*.delete (object, optional):
  • value.paths.*.delete.responses (object, optional):
  • value.paths.*.options (object, optional):
  • value.paths.*.options.responses (object, optional):
  • value.paths.*.head (object, optional):
  • value.paths.*.head.responses (object, optional):
  • value.paths.*.patch (object, optional):
  • value.paths.*.patch.responses (object, optional):
  • 400: Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.
  • value (object, optional): The specific resource.
  • error_msg (string, optional): The error message.

cURL

curl -X POST '$API_BASE_URL/api/gateway_groups/{gateway_group_id}/services/export'