API Repository
Summary
The API Repository REST API provides backend API management for the gateway
Description
With the API Repository API, it is possible to create, delete, and manage backend API in the Portal
Resources
POST /api/portal/v1.3/apirepo
Summary
Create an API definition
Description
When creating an API, the name and basePath are required.
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
- |
The API resource to create. | APIDefinition | body | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
201 | Created |
400 | Bad Request |
403 | Forbidden |
500 | Internal Server Error |
Returns Class
Example
POST https://localhost:8075/api/portal/v1.3/apirepo
Request
{"name":"My API","description":"This is my API","version":"1.0","basePath":"http://basepath.org","resourcePath":"/api","models":{"User":{"type":"object","required":["id","name","email"],"properties":{"id":{"type":"string"},"name":{"type":"string"},"email":{"type":"string"}}}},"consumes":["application/json"],"produces":["application/json"],"organizationId":"847d4626-61ef-4fcd-bc5d-28a7c206b79e"}
Response
HTTP 1.1 201 Created
{
"id" : "6d81f576-bf40-4fbd-8625-63d8f206f649",
"name" : "My API",
"summary" : "This is a summary of my API",
"description" : "This is my API",
"version" : "1.0",
"basePath" : "http://basepath.org",
"resourcePath" : "/api",
"models" : {
"User" : {
"type" : "object",
"required" : [ "id", "name", "email" ],
"properties" : {
"id" : {
"type" : "string"
},
"name" : {
"type" : "string"
},
"email" : {
"type" : "string"
}
}
}
},
"consumes" : [ "\"application/json\"" ],
"produces" : [ "\"application/json\"" ],
"integral" : true,
"createdOn" : 1364287486876,
"createdBy" : "a1c70859-702b-4f3a-a1ad-a61067fdc4c7",
"organizationId" : "7d82323230-4fbd-8625-63d8f206f649",
"serviceType" : "wsdl",
"hasOriginalDefinition" : true,
"importUrl" : "http://petstore.swagger.io/v1/swagger.json",
"properties" : {
"ServiceName" : "Calculator",
"Type" : "WSDL"
}
}
GET /api/portal/v1.3/apirepo
Summary
Get the list of API
Description
Get the list of API from the API repository. The list of API can be filtered using the expression: field=__field__&op=__op__&value=__value__. Optionally, you can add a logical operation for all expressions, using the form: &lop=AND|OR. By default, the logical operation is AND. Multiple expression filters can be used, specifying field, op, and value for each filter. The field is one of:
- id
- Matches the API by ID
- name
- Matches the API by name
The op is an operation and is one of:
- eq
- Equal
- ne
- Not equal
- gt
- Greater than
- lt
- Less than
- ge
- Greater than or equal
- le
- Less than or equal
- like
- Like
- gete
- Greater than or equal to, and less than or equal to; the value should be a lower-minimum and upper-maximum separated by comma, e.g: value=5,10
The value will be compared against the field, according to the supplied op.
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
filename |
String | query | |||
field |
Filter field name. | String | query | Multiple | |
op |
Filter operation. | String | query | Multiple | |
value |
Filter value | String / Integer | query | Multiple |
Status Codes
HTTP Status Code | Reason |
---|---|
200 | OK |
403 | Forbidden |
500 | Internal Server Error |
Returns Array
[ APIDefinition ]
Example
GET https://localhost:8075/api/portal/v1.3/apirepo?field=name&op=eq&value=MyAPI
ResponseHTTP 1.1 200 OK
[ {
"id" : "6d81f576-bf40-4fbd-8625-63d8f206f649",
"name" : "My API",
"summary" : "This is a summary of my API",
"description" : "This is my API",
"version" : "1.0",
"basePath" : "http://basepath.org",
"resourcePath" : "/api",
"models" : {
"User" : {
"type" : "object",
"required" : [ "id", "name", "email" ],
"properties" : {
"id" : {
"type" : "string"
},
"name" : {
"type" : "string"
},
"email" : {
"type" : "string"
}
}
}
},
"consumes" : [ "\"application/json\"" ],
"produces" : [ "\"application/json\"" ],
"integral" : true,
"createdOn" : 1364287486876,
"createdBy" : "a1c70859-702b-4f3a-a1ad-a61067fdc4c7",
"organizationId" : "7d82323230-4fbd-8625-63d8f206f649",
"serviceType" : "wsdl",
"hasOriginalDefinition" : true,
"importUrl" : "http://petstore.swagger.io/v1/swagger.json",
"properties" : {
"ServiceName" : "Calculator",
"Type" : "WSDL"
}
} ]
POST /api/portal/v1.3/apirepo/import
Summary
Create an API by uploading a file
Description
Imports an API definition from a valid standard Swagger or WADL definition. On import, the original API definition is retained, but the API is converted to an internal format for processing.
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
organizationId |
The API development organization ID that owns the import. | String | form | Required | |
name |
The API name. | String | form | Required | |
type |
The type of import, one of: swagger, wadl, raml | String | form | Required | |
file |
The API definition file to import | File | form | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
201 | Created |
400 | Bad Request |
403 | Forbidden |
500 | Internal Server Error |
Returns Class
POST /api/portal/v1.3/apirepo/importFromExternal
Summary
Create an API for an external service
Description
Create an API for an external service.
Since
1.2
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
organizationId |
The API development organization that owns the new API | String | form | Required | |
connectorId |
The API connector through which a new API should be created | String | form | Required | |
name |
The name of the new API | String | form | Required | |
description |
A description of the new API | String | form | Required | |
api |
List of external APIs to be included in new API definition | String | form | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
200 | OK |
400 | Bad Request |
403 | Forbidden |
500 | Internal Server Error |
Returns Class
POST /api/portal/v1.3/apirepo/importFromGw
Summary
Create an API definition by importing a PolicyStudio-registered web service (REST or WSDL) hosted on the the API Gateway
Description
Imports an API definition from a Policy Studio REST or WSDL service hosted on the API Gateway. On import, a Swagger representation of the original API definition is retained, but the API is converted to an internal format for processing.
Since
1.2
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
id |
The id of the PolicyStudio-registered service to import. | String | form | Required | |
name |
The service name. | String | form | Required | |
organizationId |
The API development organization ID that owns the import. | String | form | Required | |
instance |
String | form | |||
host |
String | form | |||
port |
String | form | |||
username |
String | form | |||
password |
String | form |
Status Codes
HTTP Status Code | Reason |
---|---|
201 | Created |
400 | Bad Request |
403 | Forbidden |
500 | Internal Server Error |
Returns Class
POST /api/portal/v1.3/apirepo/importFromUrl
Summary
Create an API by loading a file from URL.
Description
Imports an API definition from a valid standard Swagger or WADL definition from the specified url. It is possible to supply an optional username and password if the url requires HTTP Basic authentication. On import, the original API definition is retained, but the API is converted to an internal format for processing. The API name currently defaults to the filename but this will be deprecated in a future release. The name parameter should be used to name the API and will be required in a future release.
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
organizationId |
The API development organization ID that owns the import. | String | form | Required | |
name |
The name of the API. | String | form | ||
fileName |
The file name of the import. | String | form | ||
type |
The type of import, one of: swagger, wadl, raml. | String | form | Required | |
url |
The URL to import. | String | form | Required | |
username |
HTTP Basic username to use for connection. | String | form | ||
password |
HTTP Basic password to use for connection. | String | form |
Status Codes
HTTP Status Code | Reason |
---|---|
201 | Created |
400 | Bad Request |
403 | Forbidden |
500 | Internal Server Error |
Returns Class
GET /api/portal/v1.3/apirepo/{id}
Summary
Get an API by ID
Description
none
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
id |
String | path | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
200 | OK |
403 | Forbidden |
500 | Internal Server Error |
Returns Class
DELETE /api/portal/v1.3/apirepo/{id}
Summary
Deletes an API.
Description
Deletes a backend API.
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
id |
The API identifier. | String | path | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
204 | No Content |
403 | Forbidden |
500 | Internal Server Error |
PUT /api/portal/v1.3/apirepo/{id}
Summary
Updates an API
Description
none
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
id |
The API identifier. | String | path | Required | |
- |
An API definition. | APIDefinition | body | Required | |
api |
The API resource to update. | query | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
200 | OK |
400 | Bad Request |
403 | Forbidden |
500 | Internal Server Error |
Returns Class
Example
PUT https://localhost:8075/api/portal/v1.3/apirepo/{id}
Request
{
"id" : "6d81f576-bf40-4fbd-8625-63d8f206f649",
"name" : "My API",
"summary" : "This is a summary of my API",
"description" : "This is my API",
"version" : "1.0",
"basePath" : "http://basepath.org",
"resourcePath" : "/api",
"models" : {
"User" : {
"type" : "object",
"required" : [ "id", "name", "email" ],
"properties" : {
"id" : {
"type" : "string"
},
"name" : {
"type" : "string"
},
"email" : {
"type" : "string"
}
}
}
},
"consumes" : [ "\"application/json\"" ],
"produces" : [ "\"application/json\"" ],
"integral" : true,
"createdOn" : 1364287486876,
"createdBy" : "a1c70859-702b-4f3a-a1ad-a61067fdc4c7",
"organizationId" : "7d82323230-4fbd-8625-63d8f206f649",
"serviceType" : "wsdl",
"hasOriginalDefinition" : true,
"importUrl" : "http://petstore.swagger.io/v1/swagger.json",
"properties" : {
"ServiceName" : "Calculator",
"Type" : "WSDL"
}
}
Response
HTTP 1.1 200 OK
{
"id" : "6d81f576-bf40-4fbd-8625-63d8f206f649",
"name" : "My API",
"summary" : "This is a summary of my API",
"description" : "This is my API",
"version" : "1.0",
"basePath" : "http://basepath.org",
"resourcePath" : "/api",
"models" : {
"User" : {
"type" : "object",
"required" : [ "id", "name", "email" ],
"properties" : {
"id" : {
"type" : "string"
},
"name" : {
"type" : "string"
},
"email" : {
"type" : "string"
}
}
}
},
"consumes" : [ "\"application/json\"" ],
"produces" : [ "\"application/json\"" ],
"integral" : true,
"createdOn" : 1364287486876,
"createdBy" : "a1c70859-702b-4f3a-a1ad-a61067fdc4c7",
"organizationId" : "7d82323230-4fbd-8625-63d8f206f649",
"serviceType" : "wsdl",
"hasOriginalDefinition" : true,
"importUrl" : "http://petstore.swagger.io/v1/swagger.json",
"properties" : {
"ServiceName" : "Calculator",
"Type" : "WSDL"
}
}
GET /api/portal/v1.3/apirepo/{id}/download
Summary
Downloads an API by ID.
Description
Downloads an API by ID. If filename is not supplied, the API name will be used. If the API was imported using /import or /import, then it is possible to download the original API definition by setting original to true.
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
id |
String | path | Required | ||
filename |
Override the default filename for download | String | query | Required | |
original |
If true, and the API was imported, this will download the original definition | Boolean | query | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
200 | OK |
403 | Forbidden |
500 | Internal Server Error |
Return Value
application/octet-stream
POST /api/portal/v1.3/apirepo/{id}/methods
Summary
Create an API method
Description
none
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
id |
The API identifierentifier to create a method. | String | path | Required | |
- |
The method to create. | Method | body | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
201 | Created |
400 | Bad Request |
403 | Forbidden |
500 | Internal Server Error |
Returns Class
Example
POST https://localhost:8075/api/portal/v1.3/apirepo/{id}/methods
Request
{
"id" : "014d138b-816c-42b8-8a2a-5b63e72ea46d",
"apiId" : "6d81f576-bf40-4fbd-8625-63d8f206f649",
"path" : "/users",
"verb" : "GET",
"name" : "getUserById",
"summary" : "Gets a user by ID",
"description" : "If the user does not exist, then a *404 Not Found* error is returned",
"returnType" : "User",
"parameters" : [ {
"name" : "userId",
"type" : "string",
"format" : "string",
"description" : "",
"required" : true,
"allowMultiple" : false,
"items" : null,
"defaultValue" : "text",
"schema" : {
"id" : "",
"format" : "",
"$ref" : "#/definitions/User",
"type" : "string"
},
"paramType" : "body"
} ],
"responseCodes" : [ {
"code" : 404,
"message" : "Not Found",
"schema" : {
"id" : "",
"format" : "",
"$ref" : "#/definitions/User",
"type" : "string"
}
} ],
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"properties" : {
"soapOperation" : "calculator",
"soapNamespace" : ""
}
}
Response
HTTP 1.1 200 OK
{
"id" : "014d138b-816c-42b8-8a2a-5b63e72ea46d",
"apiId" : "6d81f576-bf40-4fbd-8625-63d8f206f649",
"path" : "/users",
"verb" : "GET",
"name" : "getUserById",
"summary" : "Gets a user by ID",
"description" : "If the user does not exist, then a *404 Not Found* error is returned",
"returnType" : "User",
"parameters" : [ {
"name" : "userId",
"type" : "string",
"format" : "string",
"description" : "",
"required" : true,
"allowMultiple" : false,
"items" : null,
"defaultValue" : "text",
"schema" : {
"id" : "",
"format" : "",
"$ref" : "#/definitions/User",
"type" : "string"
},
"paramType" : "body"
} ],
"responseCodes" : [ {
"code" : 404,
"message" : "Not Found",
"schema" : {
"id" : "",
"format" : "",
"$ref" : "#/definitions/User",
"type" : "string"
}
} ],
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"properties" : {
"soapOperation" : "calculator",
"soapNamespace" : ""
}
}
GET /api/portal/v1.3/apirepo/{id}/methods
Summary
Queries the list of API methods
Description
Get the list of API methods from the API repository. The list of methods can be filtered using the expression: field=__field__&op=__op__&value=__value__. Optionally, you can add a logical operation for all expressions, using the form: &lop=AND|OR. By default, the logical operation is AND. Multiple expression filters can be used, specifying field, op, and value for each filter. The field is one of:
- id
- Matches the API by ID
- name
- Matches the API by name
The op is an operation and is one of:
- eq
- Equal
- ne
- Not equal
- gt
- Greater than
- lt
- Less than
- ge
- Greater than or equal
- le
- Less than or equal
- like
- Like
- gete
- Greater than or equal to, and less than or equal to; the value should be a lower-minimum and upper-maximum separated by comma, e.g: value=5,10
The value will be compared against the field, according to the supplied op.
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
id |
String | path | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
200 | OK |
403 | Forbidden |
500 | Internal Server Error |
Returns Array
[ Method ]
Example
GET https://localhost:8075/api/portal/v1.3/apirepo/{id}/methods?field=name&op=eq&value=getUsers
ResponseHTTP 1.1 200 OK
[ {
"id" : "014d138b-816c-42b8-8a2a-5b63e72ea46d",
"apiId" : "6d81f576-bf40-4fbd-8625-63d8f206f649",
"path" : "/users",
"verb" : "GET",
"name" : "getUserById",
"summary" : "Gets a user by ID",
"description" : "If the user does not exist, then a *404 Not Found* error is returned",
"returnType" : "User",
"parameters" : [ {
"name" : "userId",
"type" : "string",
"format" : "string",
"description" : "",
"required" : true,
"allowMultiple" : false,
"items" : null,
"defaultValue" : "text",
"schema" : {
"id" : "",
"format" : "",
"$ref" : "#/definitions/User",
"type" : "string"
},
"paramType" : "body"
} ],
"responseCodes" : [ {
"code" : 404,
"message" : "Not Found",
"schema" : {
"id" : "",
"format" : "",
"$ref" : "#/definitions/User",
"type" : "string"
}
} ],
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"properties" : {
"soapOperation" : "calculator",
"soapNamespace" : ""
}
} ]
DELETE /api/portal/v1.3/apirepo/{id}/methods/{methodId}
Summary
Delete an API method
Description
Deletes a backend API method.
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
id |
The API identifier. | String | path | Required | |
methodId |
The method identifier. | String | path | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
204 | No Content |
403 | Forbidden |
500 | Internal Server Error |
GET /api/portal/v1.3/apirepo/{id}/methods/{methodId}
Summary
Get API method by ID.
Description
Retrieves a method for a given API.
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
id |
The API identifier. | String | path | Required | |
methodId |
The API method ID. | String | path | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
200 | OK |
403 | Forbidden |
500 | Internal Server Error |
Returns Class
PUT /api/portal/v1.3/apirepo/{id}/methods/{methodId}
Summary
Update an API method
Description
none
Since
1.1
Parameters
Parameter | Description | Data Type | Location | Required | Multiple |
---|---|---|---|---|---|
id |
The API identifierentifier to create a method. | String | path | Required | |
methodId |
The method identifier. | String | path | Required | |
- |
The method to update. | Method | body | Required |
Status Codes
HTTP Status Code | Reason |
---|---|
201 | Created |
400 | Bad Request |
403 | Forbidden |
500 | Internal Server Error |
Returns Class
Example
PUT https://localhost:8075/api/portal/v1.3/apirepo/{id}/methods/{methodId}
Request
{
"id" : "014d138b-816c-42b8-8a2a-5b63e72ea46d",
"apiId" : "6d81f576-bf40-4fbd-8625-63d8f206f649",
"path" : "/users",
"verb" : "GET",
"name" : "getUserById",
"summary" : "Gets a user by ID",
"description" : "If the user does not exist, then a *404 Not Found* error is returned",
"returnType" : "User",
"parameters" : [ {
"name" : "userId",
"type" : "string",
"format" : "string",
"description" : "",
"required" : true,
"allowMultiple" : false,
"items" : null,
"defaultValue" : "text",
"schema" : {
"id" : "",
"format" : "",
"$ref" : "#/definitions/User",
"type" : "string"
},
"paramType" : "body"
} ],
"responseCodes" : [ {
"code" : 404,
"message" : "Not Found",
"schema" : {
"id" : "",
"format" : "",
"$ref" : "#/definitions/User",
"type" : "string"
}
} ],
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"properties" : {
"soapOperation" : "calculator",
"soapNamespace" : ""
}
}
Response
HTTP 1.1 200 OK
{
"id" : "014d138b-816c-42b8-8a2a-5b63e72ea46d",
"apiId" : "6d81f576-bf40-4fbd-8625-63d8f206f649",
"path" : "/users",
"verb" : "GET",
"name" : "getUserById",
"summary" : "Gets a user by ID",
"description" : "If the user does not exist, then a *404 Not Found* error is returned",
"returnType" : "User",
"parameters" : [ {
"name" : "userId",
"type" : "string",
"format" : "string",
"description" : "",
"required" : true,
"allowMultiple" : false,
"items" : null,
"defaultValue" : "text",
"schema" : {
"id" : "",
"format" : "",
"$ref" : "#/definitions/User",
"type" : "string"
},
"paramType" : "body"
} ],
"responseCodes" : [ {
"code" : 404,
"message" : "Not Found",
"schema" : {
"id" : "",
"format" : "",
"$ref" : "#/definitions/User",
"type" : "string"
}
} ],
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"properties" : {
"soapOperation" : "calculator",
"soapNamespace" : ""
}
}