Skip to content

Instantly share code, notes, and snippets.

@tomkerkhove
Created June 9, 2023 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomkerkhove/e919f93e264e36825011020d21b8e580 to your computer and use it in GitHub Desktop.
Save tomkerkhove/e919f93e264e36825011020d21b8e580 to your computer and use it in GitHub Desktop.
{
"openapi": "3.0.1",
"info": {
"title": "Echo API",
"version": "1.0"
},
"servers": [
{
"url": "http://apim-sandbox-cloud-native.azure-api.net/echo"
},
{
"url": "https://apim-sandbox-cloud-native.azure-api.net/echo"
}
],
"paths": {
"/resource": {
"get": {
"summary": "Retrieve resource",
"description": "A demonstration of a GET call on a sample resource. It is handled by an \"echo\" backend which returns a response equal to the request (the supplied headers and body are being returned as received).",
"operationId": "retrieve-resource",
"parameters": [
{
"name": "param1",
"in": "query",
"description": "A sample parameter that is required and has a default value of \"sample\".",
"required": true,
"schema": {
"enum": [
"sample"
],
"type": "string",
"default": "sample"
}
},
{
"name": "param2",
"in": "query",
"description": "Another sample parameter, set to not required.",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": "Returned in all cases."
}
}
},
"put": {
"summary": "Modify Resource",
"description": "A demonstration of a PUT call handled by the same \"echo\" backend as above. You can now specify a request body in addition to headers and it will be returned as well.",
"operationId": "modify-resource",
"responses": {
"200": {
"description": ""
}
}
},
"post": {
"summary": "Create resource",
"description": "A demonstration of a POST call based on the echo backend above. The request body is expected to contain JSON-formatted data (see example below). A policy is used to automatically transform any request sent in JSON directly to XML. In a real-world scenario this could be used to enable modern clients to speak to a legacy backend.",
"operationId": "create-resource",
"requestBody": {
"content": {
"application/json": {
"example": {
"vehicleType": "train",
"maxSpeed": 125,
"avgSpeed": 90,
"speedUnit": "mph"
}
}
}
},
"responses": {
"200": {
"description": ""
}
}
},
"delete": {
"summary": "Remove resource",
"description": "A demonstration of a DELETE call which traditionally deletes the resource. It is based on the same \"echo\" backend as in all other operations so nothing is actually deleted.",
"operationId": "remove-resource",
"responses": {
"200": {
"description": ""
}
}
},
"head": {
"summary": "Retrieve header only",
"description": "The HEAD operation returns only headers. In this demonstration a policy is used to set additional headers when the response is returned and to enable JSONP.",
"operationId": "retrieve-header-only",
"responses": {
"200": {
"description": ""
}
}
}
},
"/resource-cached": {
"get": {
"summary": "Retrieve resource (cached)",
"description": "A demonstration of a GET call with caching enabled on the same \"echo\" backend as above. Cache TTL is set to 1 hour. When you make the first request the headers you supplied will be cached. Subsequent calls will return the same headers as the first time even if you change them in your request.",
"operationId": "retrieve-resource-cached",
"parameters": [
{
"name": "param1",
"in": "query",
"description": "A sample parameter that is required and has a default value of \"sample\".",
"required": true,
"schema": {
"enum": [
"sample"
],
"type": "string",
"default": "sample"
}
},
{
"name": "param2",
"in": "query",
"description": "Another sample parameter, set to not required.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": ""
}
}
}
}
},
"components": {
"securitySchemes": {
"apiKeyHeader": {
"type": "apiKey",
"name": "Ocp-Apim-Subscription-Key",
"in": "header"
},
"apiKeyQuery": {
"type": "apiKey",
"name": "subscription-key",
"in": "query"
}
}
},
"security": [
{
"apiKeyHeader": []
},
{
"apiKeyQuery": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment