curl --request POST \
--url https://{tenant}/tyk/apis/oas \
--header 'Content-Type: application/json' \
--header 'X-Tyk-Authorization: <api-key>' \
--data '
{
"components": {
"securitySchemes": {
"bearerAuth": {
"description": "The API Access Credentials",
"scheme": "bearer",
"type": "http"
}
}
},
"info": {
"description": "This is a sample OAS.",
"title": "OAS Sample",
"version": "1.0.0"
},
"openapi": "3.0.3",
"paths": {
"/api/sample/users": {
"get": {
"operationId": "getUsers",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"items": {
"properties": {
"name": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
}
}
},
"description": "fetched users"
}
},
"summary": "Get users",
"tags": [
"users"
]
}
}
},
"security": [
{
"bearerAuth": []
}
],
"servers": [
{
"url": "https://localhost:8080"
}
],
"x-tyk-api-gateway": {
"info": {
"name": "user",
"state": {
"active": true
}
},
"server": {
"listenPath": {
"strip": true,
"value": "/user-test/"
}
},
"upstream": {
"url": "https://localhost:8080"
}
}
}
'{
"action": "added",
"key": "e30bee13ad4248c3b529a4c58bb7be4e",
"status": "ok"
}Create an API with Tyk OAS API format on the Tyk Gateway.
curl --request POST \
--url https://{tenant}/tyk/apis/oas \
--header 'Content-Type: application/json' \
--header 'X-Tyk-Authorization: <api-key>' \
--data '
{
"components": {
"securitySchemes": {
"bearerAuth": {
"description": "The API Access Credentials",
"scheme": "bearer",
"type": "http"
}
}
},
"info": {
"description": "This is a sample OAS.",
"title": "OAS Sample",
"version": "1.0.0"
},
"openapi": "3.0.3",
"paths": {
"/api/sample/users": {
"get": {
"operationId": "getUsers",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"items": {
"properties": {
"name": {
"type": "string"
}
},
"type": "object"
},
"type": "array"
}
}
},
"description": "fetched users"
}
},
"summary": "Get users",
"tags": [
"users"
]
}
}
},
"security": [
{
"bearerAuth": []
}
],
"servers": [
{
"url": "https://localhost:8080"
}
],
"x-tyk-api-gateway": {
"info": {
"name": "user",
"state": {
"active": true
}
},
"server": {
"listenPath": {
"strip": true,
"value": "/user-test/"
}
},
"upstream": {
"url": "https://localhost:8080"
}
}
}
'{
"action": "added",
"key": "e30bee13ad4248c3b529a4c58bb7be4e",
"status": "ok"
}Api key
The base API which the new version will be linked to.
The version name of the base API while creating the first version. This doesn't have to be sent for the next versions but if it is set, it will override base API version name.
The version name of the created version.
If true, the new version is set as default version.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?