Create an API

post

/apiplatform/management/v1/apis

Creates an API.

Users requesting this resource must be assigned the API Manager role.

Request

Supported Media Types
Body ()
Root Schema : CreateApiRequest
Match All
Show Source
Nested Schema : ApiIdentity
Type: object
Show Source
Nested Schema : ApiDetails
Type: object
Show Source
Nested Schema : ApiImpl
Type: object
Nested Schema : ApiArtifacts
Type: object
Show Source
Nested Schema : ApiState
Type: object
Show Source
Nested Schema : CreateApiRequest-allOf[5]
Type: object
Show Source
Nested Schema : documentation
Type: object
Describes the API's documenation resource
Show Source
  • The path to the documentation resource, if attached as a file, the URL of the resource, if added as a link, or the overview text itself, if entered as text.
  • The method used to attach documentation to the API. Valid values are link, file, and text. The value is link if Apiary documentation is added.
  • The documentation type of the documentation resource. Valid values are markdown, html, and apiary.
Nested Schema : overview
Type: object
Describes the API's overview text resource.
Show Source
  • The name of the resource, if attached as a file, the URL of the resource, if added as a link, or the overview text itself, if entered as text.
  • The method used to attach overview text to the API. Valid values are link, file, and text.
  • The documentation type of the overview text resource. Valid values are markdown and html.
Nested Schema : artifacts
Type: array
Show Source
Nested Schema : items
Type: object
Show Source
Nested Schema : ApiPublication
Type: object
Show Source
Back to Top

Response

Supported Media Types

201 Response

The API was created.
Body ()
Root Schema : ApiId
Type: object
Show Source

400 Response

Bad request, indicates a problem with the input parameters.
Body ()
Root Schema : Error
Type: object
Show Source
Nested Schema : errorDetails
Type: array
additional errors
Show Source

403 Response

Forbidden.
Body ()
Root Schema : Error
Type: object
Show Source
Nested Schema : errorDetails
Type: array
additional errors
Show Source

500 Response

Unexpected error.
Body ()
Root Schema : Error
Type: object
Show Source
Nested Schema : errorDetails
Type: array
additional errors
Show Source
Back to Top

Examples

The following example shows how to create an API by submitting a POST request on the REST resource using cURL. For more information about cURL, see Use cURL

curl -X POST -H "Content-Type: application/json" -d 
'{
	"name": "weather",
	"version": "v1",
	"implementation":
	{
		"policies":[
					{ "id":"1", "type":"o:ApiRequest", "version":"1.0", "draft":true, "config":{}},
					{ "id":"2", "type":"o:ServiceRequest", "version":"1.0", "draft":true, "config":{}},
					{ "id":"3", "type":"o:ServiceResponse", "version":"1.0", "config":{}},
					{ "id":"4", "type":"o:ApiResponse", "version":"1.0", "config":{}}
		],
		"executions":{ "request":["1","2"], "response":["3","4"] }
	}
}' 
"https://example.com/apiplatform/management/v1/apis"

Sample API Template Request Body

The following example provides a template request body for creating an API. It contains the minimum required information to create an API: a name, a version, the API Request and Service Request policies in draft mode, and the Service Response and API Response policies. The template also defines the execution order of the required request and response policies.

Use this template (after editing the name and version) to create an empty API via the REST layer that matches the result of creating an API in the UI. If you have data for the API Request or Service Request policies, you can include it in your request change draft tofalse. You can add additional policies to the request. If you do, ensure you update the executions object to provide a valid execution order for the request and response flows.

{
	"name": "weather",
	"version": "v1",
	"implementation":
	{
		"policies":[
					{ "id":"1", "type":"o:ApiRequest", "version":"1.0", "draft":true, "config":{}},
					{ "id":"2", "type":"o:ServiceRequest", "version":"1.0", "draft":true, "config":{}},
					{ "id":"3", "type":"o:ServiceResponse", "version":"1.0", "config":{}},
					{ "id":"4", "type":"o:ApiResponse", "version":"1.0", "config":{}}
		],
		"executions":{ "request":["1","2"], "response":["3","4"] }
	}
}

Example of Response Headers

The following shows an example of the response headers.

HTTP/1.1 200 OK 
Server: Oracle-Traffic-Director/12.2.1.0.0
Date: Tue, 19 Jul 2016 13:27:08 GMT
Content-Length: 30
Content-Type: application/json
X-oracle-dms-ecid: dd439614-7d4f-47ad-a1ea-a25a74ec9403-0000032d
X-oracle-dms-rid: 0:1
Via: 1.1 otd_opc
Proxy-agent: Oracle-Traffic-Director/12.2.1.0.0

Example of Response Body

The following example shows the contents of the response body in JSON format, including the ID and iteration ID of the API you created.

{
  "id": "101",
  "iterationId": "1"
}
Back to Top