Create an API version from a project

Create an API version with the assets of an existing project.

POST https://{controlplane_path}/api/1/rest/public/apim/create_from_project      

Overview

Create an API version with the assets of an existing project.

The new API version can be created either in the same or another API, Project, Environment/Org, or Snaplex.

Important: This page describes a Classic APIM API.

Prerequisites

  • Read access to the source project
  • Write access to the target Org
Note:
  • The "plex_path" attribute is case sensitive.
  • Only Snaplexes placed in the global shared folder are accessible in APIM.

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/create_from_project' \
  -H 'Authorization: Basic {base64_encoded email:password}' \
  -H 'Content-Type: application/json' \
  -d '{
  "project_path": "/acme/projects/BookStoreProject",
  "plex_path": "/acme/shared/BookStorePlex",
  "api": "BookStore",
  "version": "1.0",
  "tags": ["bookstore", "retail"],
  "description": "BookStore API version 1.0",
  "asset_types": ["Pipeline", "Account"]
}'

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

{
  "project_path": "...",
  "plex_path": "...",
  "api": "...",
  "version": "...",
  "tags": [...],
  "description": "...",
  "asset_types": [...]
}
Key Type Description
project_path string Required. The path to the source project.
plex_path string Required. The path to the Snaplex. Note: This attribute is case sensitive and only Snaplexes in the global shared folder are accessible in APIM.
api string Required. The name of the API.
version string Required. The version identifier for the API version.
tags array Optional. Array of tags to apply to the API version.
description string Optional. Description of the API version.
asset_types array Required. Array of asset types to include. Allowed values: File, Job, Account, Pipeline, Policy.

Response

{
    "response_map": {},
    "http_status_code": 200
}

Error handling

{
    "http_status_code": 400,
    "response_map": {
        "error_list": [
            {
                "message": "The asset /Automation2/apim/doctest/1.0 conflicts with an existing asset, so cannot create."
            }
        ]
    }
}

{
    "http_status_code": 400,
    "response_map": {
        "error_list": [
            {
                "message": "Invalid asset type. Allowed assets are ['File', 'Job', 'Account', 'Pipeline', 'Policy']."
            }
        ]
    }
HTTP status codes Message Resolution
400 {"message": "The asset /Automation2/apim/doctest/1.0 conflicts with an existing asset, so cannot create."} If the same name assets exists in the API version, an empty API version is created. To avoid creation of an empty API version:
  • Verify and update the existing asset name.
  • Remove the asset from the API version.
400 {"message": "Invalid asset type. Allowed assets are ['File', 'Job', 'Account', 'Pipeline', 'Policy']."}
  • Reference the asset type to create the API version. For example: ["File", "Pipeline"]
    Note:
    • If you request the asset type File, it will retrieve all the files in the project.
    • You cannot request a specific asset with its name.
  • Verify if an API version with the same name already exists