Import
The import API receives the ZIP file from the Export API and includes many options to add, replace, or update services in the destination environment. The API is designed not to proceed if a successful import cannot be completed.
Prerequisites to import Spark services
Only one job can be run at a time per tenant.
Any destination folders need to already exist and be accessible with the provided authorization.
The uploaded package size does not exceed the configured limit (default to
200 MB).
Import actions for Spark services
The services_modify and services_existing parameters can be used to control the destination and overwrite behaviors.
The
services_modifyservice_uri_sourceandservice_uri_destinationparameters can be used to map each source service to a destination. This is useful if the folder and service names in production are different from those in a lower environment.The
services_existingparameter controls the behavior if the destination already exists.Where possible, the existing
version_idof a service version will be migrated to the new environment (see Execute API (v3) for more information about theversion_id).
Service does not currently exist
does not impact import action
A new service will be added with all of the service versions included in the source.
Service currently exists
not defined
The import will fail.
Service currently exists
abort
The import will fail.
Service currently exists
replace
The destination service and service versions will be replaced by the service in the source. Note that the previous API Call History for the service will no longer be accessible.
Service currently exists
add_version
The destination service will be updated with the service versions included from the source. The semantic versioning will follow the parameter provided in update_version_type.
Authorization
Bearer {token}accessible from Authorization - Bearer token or systematically via Client credentials.The request headers should include a key for
Authorizationwith the valueBearer {token}.
API key created from Authorization - API keys. It must contain User groups that are also assigned to Permissions - Features permissions
Spark.Imports.jsonorSpark.AllEncompassingProxy.json.The request headers should include the keys
x-synthetic-keyandx-tenant-namewith the values of the API key and tenant name respectively.
POST import job
Path parameters
tenant *
Tenant is part of your sign-in URL and also available in the User menu.
Request body
Content-Type: multipart/form-data
file *
File to import from the previous step.
importRequestEntity
Stringified JSON content of the importRequestEntity parameters. If not provided, sensible defaults will be attempted for the import.
importRequestEntity parameters
inputs.services_modify
Array of services modify objects. If not provided, it is assumed that the destination is taken from the source folder and service name.
The primary use of this parameter is to modify the destination of the exported service. Settings will apply only to the noted services.
JSON array of the imported service settings:
service_uri_sourceinCS.SPARK_XCALL(){folder}/{service}reference the service provided in the source.service_uri_destinationinCS.SPARK_XCALL(){folder}/{service}format to change destinationfolderandservice. If omitted assume the same value asservice_uri_source.update_version_typemajor,minor, orpatch. If omitted, assumeminoras default. This only applies whenservices_existingisadd_version. Alternatively, ifcopyis provided, then Spark will try to use the exact same semantic versionsas the source.
See the sample request for an example.
services_existing
Optional parameter that defines how to process the service if there is an existing service in the destination folder with the same service name and is accessible.
The default value is
abortwhich fails the import if a service already exists in the destination folder and service.replacemeans the entire service will be removed and replaced with the service versions in the imported file. Note that the previous API Call History for the service will no longer be accessible.If there are existing overlapping semantic versions between the destination and source, this will maintain the existing
version_id.
add_versionmeans that any existing services will be updated with the service versions included in the file.
source_system
Tag API call.
Example: mycicd
correlation_id
Tag API call.
Example: 456
Sample request and response
The exported
ZIPcontains a service taken from the foldermyproductservicemyservice.The destination for this service is the folder
newproductand servicenewservice.The service version semantic versions will be incremented with a
majorrevision number, e.g. from1.3.1to2.0.0.
GET import status
Path parameters
tenant *
Tenant is part of your sign-in URL and also available in the User menu.
jobId *
id from POST import job.
Response
Content-Type: application/json
object
import
id
id for the job.
response_timestamp
Response timestamp.
status
createdJob registered on Spark.in_progressJob in progress.closedJob completed successfully.closed_by_timeoutJob was unable to complete within15 min.failedJob was not able to complete.
status_url
Link to the GET status API.
process_time
Time taken for the job.
outputs.files
Array of the output files:
fileLink to the package. Filename of the exported object ispackage.zip. This can be overridden with thefile_nameparameter.file_hashSHA-256of the packaged file.
outputs.services
Array of the imported services sorted by folder_source, service_source:
service_uri_sourceinCS.SPARK_XCALL()format of{folder}/{service}folder_sourceservice_sourceservice_id_sourceservice_uri_destinationinCS.SPARK_XCALL()format of{folder}/{service}folder_destinationservice_destinationservice_id_destinationstatus:addedservice did not exist and it was added.replacedservice exists and was replaced.updatedservice exists and new service versions were added.
outputs.service_versions
Array of the imported service versions sorted by folder_source, service_source, version_source:
service_uri_sourceinCS.SPARK_XCALL()format of{folder}/{service}[{version}]folder_sourceservice_sourceversion_source(semantic version)service_id_sourceversion_id_sourceservice_uri_destinationinCS.SPARK_XCALL()format of{folder}/{service}[{version}]folder_destinationservice_destinationversion_destinationservice_id_destinationversion_id_destinationstatus:addedservice version was added.replacedservice version existed and was replaced.
source_system
Value from POST import job.
correlation_id
Value from POST import job.
Sample request and response
PATCH import status to cancel job
Path parameters
tenant *
Tenant is part of your sign-in URL and also available in the User menu.
jobId *
id from POST import job.
Request body
Content-Type: application/json
Include this line in the JSON body to cancel the import at any time.
Sample request and response
GET import jobs across the tenant
If you are a
supervisor:pfuser, you will be able to see all imports run by users within your tenant.Otherwise, you will only see information about the batches that were initiated by yourself.
Path parameters
tenant *
Tenant is part of your sign-in URL and also available in the User menu.
Sample request and response
Last updated
