Create an API
/apiplatform/management/v1/apis
Creates an API.
Users requesting this resource must be assigned the API Manager role.
Request
- application/json
object
-
name:
string
The API's name.
-
vanityName(optional):
string
The API's vanity name.
-
version:
string
The API's version.
object
-
description(optional):
string
The API's description.
-
documentation(optional):
object documentation
Describes the API's documenation resource
-
icon(optional):
string
The API's icon.
-
overview(optional):
object overview
Describes the API's overview text resource.
object
object
-
state(optional):
string
The API's state. Valid values are
ALPHA
,BETA
,DEPRECATED
,RELEASED
, andRETIRED
. -
stateComments(optional):
string
Comments about the API's state.
-
stateUpdatedAt(optional):
string
The date and time the API state was last updated.
-
stateUpdatedBy(optional):
string
The user who last updated the API state.
object
-
data(optional):
string
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.
-
dataType(optional):
string
The method used to attach documentation to the API. Valid values are
link
,file
, andtext
. The value islink
if Apiary documentation is added. -
doctype(optional):
string
The documentation type of the documentation resource. Valid values are markdown, html, and apiary.
object
-
data(optional):
string
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.
-
dataType(optional):
string
The method used to attach overview text to the API. Valid values are
link
,file
, andtext
. -
doctype(optional):
string
The documentation type of the overview text resource. Valid values are
markdown
andhtml
.
object
-
content(optional):
string
-
content-type:
string
The content type of the attached resource, like
text/html; charset=utf-8
. -
pathname:
string
The path to the API resource.
object
-
iterationId(optional):
string
The iteration ID of the API published to the Developer Portal.
-
portalUrl(optional):
string
The URL of the API's page on the Developer Portal.
-
state(optional):
string
The API's publication state. This value indicates if the API is published to the Developer Portal. Valid values are
PUBLISHED
andUNPUBLISHED
. -
stateComments(optional):
string
Comments about the publication's state.
-
stateUpdatedAt(optional):
string
The date and time the publication state was last updated.
-
stateUpdatedBy(optional):
string
The user who last updated the publication state.
-
visibility(optional):
string
The API's visibility level.
Response
- application/json
201 Response
400 Response
object
-
detail(optional):
string
Detailed error message
-
errorCode(optional):
string
Application specific error code
-
errorDetails(optional):
array errorDetails
additional errors
-
errorPath(optional):
string
-
instance(optional):
string
URI to the link that provides more detail about the error
-
status(optional):
string
HTTP status code
-
title:
string
Summary error message
-
type:
string
Error type
403 Response
object
-
detail(optional):
string
Detailed error message
-
errorCode(optional):
string
Application specific error code
-
errorDetails(optional):
array errorDetails
additional errors
-
errorPath(optional):
string
-
instance(optional):
string
URI to the link that provides more detail about the error
-
status(optional):
string
HTTP status code
-
title:
string
Summary error message
-
type:
string
Error type
500 Response
object
-
detail(optional):
string
Detailed error message
-
errorCode(optional):
string
Application specific error code
-
errorDetails(optional):
array errorDetails
additional errors
-
errorPath(optional):
string
-
instance(optional):
string
URI to the link that provides more detail about the error
-
status(optional):
string
HTTP status code
-
title:
string
Summary error message
-
type:
string
Error type
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" }