Import APIM policies
POST https://{controlplane_path}/api/1/rest/public/apim/import_policies
Import a set of policies into an API or API version.
Important: This page describes a Classic APIM API.
Prerequisites
- Environment (Org) admin permissions
Example
This example uses Basic authentication. For a JWT example, refer to Authentication.
curl -X 'POST' \
'https://elastic.snaplogic.com/api/1/rest/public/apim/import_policies' \
-H 'Authorization: Basic {base64_encoded email:password}' \
-H 'Content-Type: application/json' \
-d '{
"path": "/acme/apim/BookStore/1.0",
"policies_to_import": {}
}'
Path parameters
| Key | Description |
|---|---|
controlplane_path |
Required. The path to the SnapLogic control plane:
elastic.snaplogic.com
For the UAT or EMEA control plane, substitute the name for elastic. For
example:
|
Query parameters
None.
Request header
Use the application/json content type with basic authentication (email
and password) or a JWT. For examples, refer to Authentication.
Request body
{
"path" : "...",
"policies_to_import" : { ... }
}
| Key | Type | Description |
|---|---|---|
path |
string |
The path to the API or the API version.
Format:
|
policies_to_import |
JSON object | The JSON object returned by the Export APIM policies API.
Example:
|
Response
{
"response_map": {
"import_results": {
"overrode": [ ... ],
"ignored": [ ... ],
"imported": [ ... ]
}
},
"http_status_code": 200
}
| Key | Type | Description |
|---|---|---|
overrode |
array | An array of strings containing the names of the policies that were overridden. |
ignored |
array | An array of strings containing the names of the policies that were ignored. |
imported |
array | An array of strings containing the names of the policies that were successfully imported. |
Error handling
| HTTP status codes | Message | Resolution |
|---|---|---|
| 400 | May not have Read permission for org: {org_name} | Verify you have Org admin permissions. |
| 401 | Unauthorized | Verify your credentials and permissions. |
| 403 | Policies are assigned to only Container and no other asset | Verify the path points to a supported container type (API or API version). |
| 404 | The given path ({path}) doesn't exist | Verify the target path is correct and the asset exists. |