APIs
Import API definition
Import API definition
⚠️ Support only v4 API for the moment. ⚠️<br> Create an API by importing from an Open API descriptor. <br> This definition can be retrieved from GET /environments/{envId}/apis/{apiId}/_export/definition
post/environments/{envId}/apis/_import/swagger
Request body
Response
API successfully created
Example response
{
"id": "00f8c9e7-78fc-4907-b8c9-e778fc790750",
"name": "My Api",
"description": "I can use many characters to describe this API.",
"crossId": "df83b2a4-cc3e-3f80-9f0d-c138c106c076",
"apiVersion": "v1.0",
"definitionVersion": "V4",
"groups": [
"6c530064-0b2c-4004-9300-640b2ce0047b",
"12559b64-0b2c-4004-9300-640b2ce0047b"
],
"state": "STARTED",
"deploymentState": "DEPLOYED",
"visibility": "PUBLIC",
"labels": [
"json",
"read_only",
"awesome"
],
"lifecycleState": "CREATED",
"tags": [
"public",
"private"
],
"primaryOwner": {
"id": "00f8c9e7-78fc-4907-b8c9-e778fc790750",
"displayName": "John Doe"
},
"categories": [
"health",
"media"
],
"originContext": {
"origin": "MANAGEMENT"
},
"definitionContext": {
"origin": "MANAGEMENT",
"mode": "FULLY_MANAGED",
"syncFrom": "MANAGEMENT"
},
"workflowState": "DRAFT",
"_links": {
"pictureUrl": "https://gravitee.example.com/management/v2/environments/00f8c9e7-78fc-4907-b8c9-e778fc790750/apis/6c530064-0b2c-4004-9300-640b2ce0047b/picture",
"backgroundUrl": "https://gravitee.example.com/management/v2/environments/00f8c9e7-78fc-4907-b8c9-e778fc790750/apis/6c530064-0b2c-4004-9300-640b2ce0047b/background"
},
"type": "MESSAGE",
"listeners": [
{
"type": "HTTP",
"entrypoints": [
{
"type": "http-get",
"qos": "NONE"
}
]
}
],
"endpointGroups": [
{
"name": "default-endpoint-group",
"type": "default",
"loadBalancer": {
"type": "ROUND_ROBIN"
},
"endpoints": [
{
"name": "default-endpoint",
"type": "mock"
}
]
}
],
"analytics": {
"tracing": {
"redaction": {
"defaultReplacement": "[REDACTED]",
"rules": [
{
"attributeNamePattern": "http.request.header.authorization",
"maskingStrategy": {
"type": "FULL",
"replacement": "[REDACTED]"
},
"valuePattern": "^Bearer "
}
]
}
}
},
"flowExecution": {
"mode": "BEST_MATCH"
},
"flows": [
{
"id": "4e6abbd2-c0c6-462d-be9e-6371209af34b",
"name": "My Flow",
"selectors": [
{
"type": "HTTP",
"path": "/my/path",
"pathOperator": "EQUALS",
"methods": [
"GET"
]
}
],
"tags": [
"tag1",
"tag2"
]
}
]
}