Import individual assets
POST https://{controlplane_path}/api/1/rest/public/project/import/asset_path
Overview
This API imports individual assets within the same project, accounts, pipelines, tasks, and files.
Prerequisites
- Read access to the source
- Write access to the target
Request
POST https://{controlplane_path}/api/1/rest/public/project/import/asset_path?{query_parameter}
Path parameters
| Key | Description |
|---|---|
controlplane_path |
Required. The SnapLogic control plane host:
elastic.snaplogic.com (US) or
emea.snaplogic.com (EU). |
asset_path |
The path to the target individual asset. Format:
|
Query parameters
| Key | Type | Description |
|---|---|---|
duplicate_check |
string | Indicates how to handle duplicates between the source and the
destination during import. Valid values:
|
overwrite_types |
list | A comma-separated list of asset types that can be overwritten
if an asset with the same name already exists in the destination
project.
Example:
Valid values:
Note:
Job in the API corresponds to
a task in the SnapLogic interface.Note: Policies are always overwritten.
|
Request header
Specify Basic for authorization and multipart/form-data for content type.
Authorization: Basic {your_encoded_security_credentials}
Content-Type: multipart/form-data
Example
Import individual assets into the destination project, overwriting existing pipelines and tasks:
POST https://elastic.snaplogic.com/api/1/rest/public/project/import/MyOrg/MyProjectSpace/MyProject?duplicate_check=overwrite&overwrite_types=Pipeline,Job
The request body is a multipart/form-data payload with the
following fields:
file_handle: The zip file exported from the source project.file_account(optional): A JSON file containing account values to update during import.file_expr(optional): A zip file containing expression files to add to the project.
Request body
| Key | Type | Description |
|---|---|---|
file_handle |
string | The unmodified zip file of the source individual assets that was exported. |
file_account |
string | Optional. The JSON file containing the
list of accounts to modify. To create this file:
|
file_expr |
string | Optional. A zip file containing
expression files to add to the root of the project in the new
location. If an expression file with the same name already exists in the target location, it is overwritten. If this file is not provided, no additional expression files are added to the project. Important: If the zip file contains folders, the
folder structure is flattened. If duplicate filenames exist
in different folders of the zip file, only one of those
files is copied to the new location.
Example: An expression library
file (typically with the
|
Response
{
"response_map": {
"successful": [
{
"snode_id": "65b124ad2c22dd5a9d774dff",
"name": "Sample Book API-Test-1.0.0.json"
},
{
"snode_id": "65b124daca75d153d3026009",
"name": "Sample Book API-Test-1.0.0-2024-01-24 14:55:20.json"
},
{
"snode_id": "65b129e90d78973459c47123",
"name": "Sample Book API-Test-1.2.0.json"
}
],
"failed": [
{
"reason": "HTTP Code: 401 Status: GET https://canary.elastic.snaplogicdev.com/api/1/rest/asset/Automation2/abc/Test//books_pipeline: UNAUTHORIZED Errors: {'http_status_code': 401, 'response_map': {'error_list': [{'message': 'Authentication required.'}]}}. error_response: [{'message': 'Authentication required.'}]",
"snode_id": "65b124aa411a3e956a84876a",
"name": "books_pipeline",
"status_code": 401
},
{
"reason": "HTTP Code: 401 Status: GET https://canary.elastic.snaplogicdev.com/api/1/rest/asset/Automation2/abc/Test//books: UNAUTHORIZED Errors: {'http_status_code': 401, 'response_map': {'error_list': [{'message': 'Authentication required.'}]}}. error_response: [{'message': 'Authentication required.'}]",
"snode_id": "65b124aa505cc8be84f2707e",
"name": "books",
"status_code": 401
}
],
"warnings": []
},
"http_status_code": 200
}
| Key | Type | Description |
|---|---|---|
successful |
array | An array of objects that contain:
For successfully updated accounts, |
failed |
array | An array of objects that contain:
|
warnings |
array | An array of objects that contain:
|