Validate a Policy
/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
- application/json
-
apiId: string
A unique ID referencing a specific API.
Response
- application/json
200 Response
object
-
diagnostics(optional):
array diagnostics
-
severity(optional):
string
Result of the validation. The value is OK if the policy validation suceeded; the value is Error if the policy validation failed.
object
-
location(optional):
string
-
message(optional):
string
A message indicating why the validation failed.
-
severity(optional):
string
The severity of the validation failure.
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 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." } ] }