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:
  • uat.elastic.snaplogic.com
  • emea.snaplogic.com

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.
  • The path comparison is case-sensitive.
Format:
  • API: /{env_org}/apim/{api_name}
  • API version: /{env_org}/apim/{api_name}/{api_version}
policies_to_import JSON object The JSON object returned by the Export APIM policies API.
Example:
 "policies_to_import" : {
  "0": [
    {
      "class_id": "com-snaplogic-policies-validation-earlyrequestvalidator",
      "class_build_tag": "...",
      "class_fqid": "...",
      "class_version": 1,
      ...
    }
  ],
  "class_id": "com-snaplogic-policy-export",
  "class_version": 1,
  "source_org": "myEnvOrg"
}

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.