Validate a Policy

post

/apiplatform/management/v1/apis/{apiId}/validation

Validates the policy definition you send in the request body for the {apiId} API. The policy object must contain the policy type, version, and a config object. The data sent in the config object depends on the policy you want to validate. The response contains a validation object describing if the policy definition you sent is valid or invalid; if invalid, the response also contains an error message that will help you troubleshoot the policy configuration.

Users requesting this resource must be assigned the API Manager role and must be issued the Manage API grant for the specified API.

Request

Supported Media Types
Path Parameters
Body ()
Root Schema : ValidateApiRequest
Type: object
Show Source
Nested Schema : policy
Type: object
Show Source
Back to Top

Response

Supported Media Types

200 Response

The validation report.
Body ()
Root Schema : ValidateApiResponse
Type: object
Show Source
Nested Schema : diagnostics
Type: array
Show Source
Nested Schema : items
Type: object
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 validate a policy configuration by submitting a POST request on the REST resource using cURL. For more information about cURL, see Use cURL

curl -i -X POST 
-H "Authorization: Bearer access_token"
-H "Content-Type:application/json"
-d @validate.json
https://example.com/apiplatform/management/v1/apis/{apiId}/validation

{apiId} is the unique ID for an API. To retrieve available API Ids, see Get APIs.

Example of Request Body

The following shows an example of the request body for validating an API Request URL policy in JSON format, included with the request above in a file named validate.json.

{
	"policy": {
		"type": "o:ApiRequest",
		"version": "1.0",
		"config": {
			"url": "exampleEndpoint",
			"protocols": ["HTTP"]
		}
	}
}

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:  Fri, 17 Mar 2017 04:49:20 GMT
Content-Length:  34
Content-Type:  application/json
X-oracle-dms-ecid:  f102c33f-1c5b-4409-806d-03bf5706c492-0002a6cb
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 for a successful policy validation.

{
    "severity": "OK",
    "diagnostics": []
}

The following example shows the contents of the response body in JSON format, including a message for an unsuccessful validation:

{
    "severity": "Error",
    "diagnostics": [
        {
            "severity": "Error",
            "message": "The attribute \"policy\" is required."
        }
    ]
}
Back to Top