B Actions Management REST-Based API

This appendix describes the RESTful API interface that Oracle Communications Services Gatekeeper uses to manage the actions that operate on traffic for an API.

Understanding the Actions Management API

You use this API to replicate the functionality found in the Actions tab for individual APIs in the Partner and API Management Portal.

Like any RESTful API, the Actions Management API makes its services available to client applications through simple HTTP requests. However, HTTP secure (https) is required for all operations in this API.

Several types of clients connect to Services Gatekeeper, including the Administration Console client process and the portal GUIs. Services Gatekeeper listens for Actions Management API requests at the port configured for client HTTP access. Before using this API, ensure that the Managed Server is configured to accept web requests.

This API is defined in the actionChains.wadl file.

Understanding Actions Management API Error Handling.

This API shares the same error handling characteristics as the API Management API. See "Understanding API Management API Error Handling" for details.

Actions Management Operations

The following sections list the RESTful operations of the Actions Management API.

submitActionChain

You use this method to submit a chain of actions for an API.

Authorization

Basic

HTTP Method

POST

URI

/submitActionChain

Request Body

This operation accepts these request body parameters:

  • The serviceURI that identifies the API.

  • A list of requestActions values to perform, each includes the action name and a string defining the action. See "Sample requestAction Schemas" for examples.

  • The version of the API to run the actions against.

Sample requestAction Schemas

This section lists example action schemas. You use these actions in the requestAction field of the submitActionChain method.

This example schema is for a callout action:

Name: Callout

Action:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="calloutActionConfig" type="calloutActionConfig"/>
    <xs:complexType final="extension restriction" name="calloutActionConfig">
        <xs:sequence>
            <xs:element minOccurs="0" name="requestUrl" type="xs:string"/>
            <xs:element minOccurs="0" name="storeResponse" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

This example schema is for a Groovy action:

Name: Groovy

Action:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="groovyActionConfig" type="groovyActionConfig"/>
    <xs:complexType final="extension restriction" name="groovyActionConfig">
        <xs:sequence>
            <xs:element minOccurs="0" name="groovyScript" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

This example schema is for an XLST action:

Name: XLST

Action:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="xsltActionConfig" type="xsltActionConfig"/>
    <xs:complexType final="extension restriction" name="xsltActionConfig">
        <xs:sequence>
            <xs:element minOccurs="0" name="xslt" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

This example schema is for a schema validation action:

Name: SchemaValidation

Action:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="schemaValidateActionConfig" type="schemaValidateActionConfig"/>
    <xs:complexType name="schemaValidateActionConfig">
        <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0"
                name="apiSchemas" nillable="true" type="apiSchema"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType final="extension restriction" name="apiSchema">
        <xs:sequence>
            <xs:element minOccurs="0" name="content" type="xs:string"/>
            <xs:element minOccurs="0" name="name" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>

This example schema is for a Jason2Xml action:

Name: Json2Xml

Action:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="json2XmlAction">
        <xs:sequence/>
    </xs:complexType>
</xs:schema>

This example schema is for an Xml2Jason action (empty):

Name: Xml2Json

Action:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="xml2JsonAction">
        <xs:sequence/>
    </xs:complexType>
</xs:schema>

Response Body

This operation returns an HTTP 200 status code on success, and an HTTP error status code on failure.

Example Request

http://op:192.168.10.1@localhost:8001/prm_pm_rest/services/prm_pm/
services/partner_manager/actionchain/submitActionChain
'{"createAPI":{"apiObject":{"apiName":"weather","apiVersion":"1","accessUrl":
"http://localhost:8001/daf/weather/1","apiInterfaces":[{"name":"weather-v1",
"apiMethods":[{"name":"main","displayName":"main","path":"/","httpVerb":"GET",
"servicePath":"/","
serviceHttpVerb":"GET","expose":true}],"displayName":"weather-v1","fileLocation":"
http://www.weather-documentation.com/"}],"wadlFiles":[],"northBoundWadlFiles":[],"
description":"An API Describing the weather in a specific zipcode","facade":"REST","direction":"AOMT","seviceType":"by-url","protocol":
"http://www.weather.com","privilege":0,"link":
"http://www.weather-documentation.com/","accessType":"HTTP","authType":"NONE",
"authToken":"","networkProxy":"","networkAuthorizationURI":"","networkTokenURI":"
","networkClientRedirectURI":"","groups":null,"icon":"expressive/weather.png"}}}'

Example Response

HTTP/1.1 200 OK
Content-Type: application/json

retrieveActionChain

You use this method to retrieve the actions for an API, by sending in the serviceUrl that identifies the API.

Authorization

Basic

HTTP Method

GET

URI

/retrieveActionChain/serviceURI

Where serviceURI identifies the API to retrieve an action chain for.

Request Body

This operation does not send any request body parameters:

Response Body

A successful response includes:

  • An HTTP 200 OK status message.

  • The name of the API.

  • A list actions to perform, each includes the action name and a string defining the action.

  • The current API version.

An unsuccessful response returns an HTTP 400 status message.

Example Request

http://op:192.168.10.1@localhost:8001/prm_pm_rest/services/prm_pm/
services/partner_manager/actionchain/retrieveActionChain/testWeatherApp

Example Response

Some of the actions in this example response are custom actions:

 {"retrieveActionChainResponse":{"requestActions":[{"name":"HeaderValidation","
content":"<?xml version=\"1.0\" encoding=\"UTF-8\"
 standalone=\"yes\"?>\n<headerValidationActionConfig>\n
 <headerKey>bob</headerKey>\n
 <headerValue>123</headerValue>\n</headerValidationActionConfig>\n"},
{"name":"BlackList","content":"<?xml version=\"1.0\"
 encoding=\"UTF-8\" standalone=\"yes\"?>\n<blackListActionConfig>\n
 <address>localhost</address>\n</blackListActionConfig>\n"}],"configVersion":9}}

loadActionSchemas

You use this method to retrieve the action schemas.

Authorization

Basic

HTTP Method

GET

URI

/loadActionSchemas

Request Body

This operation does not send any request body parameters. It returns actions for all schemas.

Response Body

A successful operation returns these parameters:

  • The name of the action.

  • The schema itself.

  • Any flow restriction (including the flow restriction string and request/response.

  • Any PRE or POST-processing restriction, including the restriction itself, and a POST or PRE value.

  • A description of the action schema.

An unsuccessful response returns an HTTP 400 status message.

Example Request

http://op:192.168.10.1@localhost:8001/prm_pm_rest/services/prm_pm/
services/partner_manager/actionchain/loadActionSchemas

Example Response

The response will look like the schemas in "Sample requestAction Schemas".

verifyAction

You use this method to verify the validity of an action. This method is used by the Validate button on the Actions sub-tab of the API and Partner Management Portal for individual APIs. A successful response returns an HTTP 200 status message. An unsuccessful response returns an HTTP failure status message, and whatever details are available.

Authorization

Basic

HTTP Method

POST

URI

/verifyAction

Request Body

This operation accepts these request body parameters:

  • An array of name parameters that identify actions.

  • An array of content parameters includes the XML data that corresponds to the actions configuration.

Example Request

http://op:192.168.10.1@localhost:8001/prm_pm_rest/services/prm_pm/
services/partner_manager/actionchain/verifyAction
 '{"verifyAction":{"name":"Groovy","actionConfig":"<?xml version=\"1.0\"
 encoding=\"UTF-8\" standalone=\"yes\"?><groovyActionConfig><groovyScript>&amp;
^&amp;$%^&amp;$^%&amp;$%^&amp;</groovyScript></groovyActionConfig>"}}' 

Example Response

This example shows a successful validation response:

HTTP/1.1 200 OK
Content-Type: application/json

This example shows a failed Groovy action response:

HTTP/1.1 500 Internal Server Error
Date: Wed, 23 Sep 2015 18:00:23 GMT
Content-Length: 251
Content-Type: text/plain
 
RESTful facade receives internal exception,refer the server log for detail:
class oracle.ocsg.portal.ws.partner_manager.actionchain.ActionChainException
Detail Message: 1 problem found in configuration.
[1]: unexpected token: & @ line 14, column 1.