API (Collection)


Retrieve/Search APIs
GET https://apis.wso2.com/api/am/publisher/v0.10/apis

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.

OAuth 2.0 Scope

apim:api_viewi

Request

GET https://127.0.0.1:9443/api/am/publisher/v0.10/apis Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8

Response

HTTP/1.1 200 OK Content-Type: application/json { "previous": "", "list": [ { "provider": "admin", "version": "1.0.0", "description": "This sample API provides Account Status Validation", "name": "AccountVal", "context": "/account", "id": "2e81f147-c8a8-4f68-b4f0-69e0e7510b01", "status": "PUBLISHED" }, { "provider": "admin", "version": "1.0.0", "description": null, "name": "api1", "context": "/api1", "id": "3e22d2fb-277a-4e9e-8c7e-1c0f7f73960e", "status": "PUBLISHED" } ], "next": "", "count": 2 }

Sample CURL

curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8" https://127.0.0.1:9443/api/am/publisher/v0.10/apis

Parameters

Type Name Description Schema Default
Query

limit

optional

Maximum size of resource array to return.

Integer

25

Query

offset

optional

Starting point within the complete list of items qualified.

Integer

0

Query

query

optional

**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 is exactly "wso2". Additionally you can use wildcards. Eg. "provider:wso2*" will match an API if the provider of the API starts with "wso2". Supported attribute modifiers are [**version, context, status, description, subcontext, doc, provider**] If no advanced attribute modifier has been specified, search will match the given query string against API Name.

String

Header

Accept

optional

Media types acceptable for the response. Default is application/json.

String

application/json

Header

If-None-Match

optional

Validator for conditional requests; based on the ETag of the formerly retrieved variant of the resourec.

String

Responses

HTTP Code Description Schema

200

OK. List of qualifying APIs is returned.

APIList

304

Not Modified. Empty body because the client has already the latest version of the requested resource (Will be supported in future).

406

Not Acceptable. The requested media type is not supported

Error

Create a new API
POST https://apis.wso2.com/api/am/publisher/v0.10/apis

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.

OAuth 2.0 Scope

apim:api_createi

Request

POST https://127.0.0.1:9443/api/am/publisher/v0.10/apis Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8 { "name": "PizzaShackAPI", "description": "This document describe a RESTFul API for Pizza Shack online pizza delivery store.\r\n", "context": "/pizzashack", "version": "1.0.0", "provider": "admin", "apiDefinition": "{\"paths\":{\"/order\":{\"post\":{\"x-auth-type\":\"Application & Application User\",\"x-throttling-tier\":\"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-tier\":\"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\"}}", "wsdlUri": null, "status": "PUBLISHED", "responseCaching": "Disabled", "cacheTimeout": 300, "destinationStatsEnabled": false, "isDefaultVersion": false, "transport": [ "http", "https" ], "tags": ["pizza"], "tiers": ["Unlimited"], "maxTps": { "sandbox": 5000, "production": 1000 }, "visibility": "PUBLIC", "visibleRoles": [], "visibleTenants": [], "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\"}", "endpointSecurity": { "username": "user", "type": "basic", "password": "pass" }, "gatewayEnvironments": "Production and Sandbox", "sequences": [], "subscriptionAvailability": null, "subscriptionAvailableTenants": [], "businessInformation": { "businessOwnerEmail": "marketing@pizzashack.com", "technicalOwnerEmail": "architecture@pizzashack.com", "technicalOwner": "John Doe", "businessOwner": "Jane Roe" }, "corsConfiguration": { "accessControlAllowOrigins": ["*"], "accessControlAllowHeaders": [ "authorization", "Access-Control-Allow-Origin", "Content-Type", "SOAPAction" ], "accessControlAllowMethods": [ "GET", "PUT", "POST", "DELETE", "PATCH", "OPTIONS" ], "accessControlAllowCredentials": false, "corsConfigurationEnabled": false } }

Response

HTTP/1.1 201 Created Location: https://127.0.0.1:9443/api/am/publisher/v0.10/apis/7a2298c4-c905-403f-8fac-38c73301631f Content-Type: application/json { "id": "7a2298c4-c905-403f-8fac-38c73301631f", "name": "PizzaShackAPI", "description": "This document describe a RESTFul API for Pizza Shack online pizza delivery store.\r\n", "context": "/pizzashack", "version": "1.0.0", "provider": "admin", "apiDefinition": "{\"paths\":{\"/order\":{\"post\":{\"x-auth-type\":\"Application & Application User\",\"x-throttling-tier\":\"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-tier\":\"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\"}}", "wsdlUri": null, "status": "CREATED", "responseCaching": "Disabled", "cacheTimeout": 300, "destinationStatsEnabled": null, "isDefaultVersion": false, "transport": [ "http", "https" ], "tags": ["pizza"], "tiers": ["Unlimited"], "maxTps": { "sandbox": 5000, "production": 1000 }, "thumbnailUri": null, "visibility": "PUBLIC", "visibleRoles": [], "visibleTenants": [], "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\"}", "endpointSecurity": { "username": "user", "type": "basic", "password": "pass" }, "gatewayEnvironments": "Production and Sandbox", "sequences": [], "subscriptionAvailability": null, "subscriptionAvailableTenants": [], "businessInformation": { "businessOwnerEmail": "marketing@pizzashack.com", "technicalOwnerEmail": "architecture@pizzashack.com", "technicalOwner": "John Doe", "businessOwner": "Jane Roe" }, "corsConfiguration": { "accessControlAllowOrigins": ["*"], "accessControlAllowHeaders": [ "authorization", "Access-Control-Allow-Origin", "Content-Type", "SOAPAction" ], "accessControlAllowMethods": [ "GET", "PUT", "POST", "DELETE", "PATCH", "OPTIONS" ], "accessControlAllowCredentials": false, "corsConfigurationEnabled": false } }

Sample 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/v0.10/apis

Parameters

Type Name Description Schema Default
Body

body

required

API object that needs to be added

API (API)

Header

Content-Type

required

Media type of the entity in the body. Default is application/json.

String

application/json

Responses

HTTP Code Description Schema

201

Created. Successful response with the newly created object as entity in the body. Location header contains URL of newly created entity.

API

400

Bad Request. Invalid request or validation error.

Error

415

Unsupported Media Type. The entity of the request was in a not supported format.

Error