Skip to content

REST API Folders#

TIP

Add the following command after the username and password to receive more meaningful HTTP errors:

-w"\n%{http_code}\n"

This command can be added to each call.

Download a Folder as a ZIP File#

  • Request Method - GET
  • Description - Downloads the folder and all its contents including sub folders and their contents.
  • URI Syntax - curl -u <username>:<password> -X GET -o <name>.zip 'http://<SpectrumServer>:<port>/api/filesystem/folders/<folderPath>||<UUID>||<file-id>/backup'
  • Verification - The ZIP file downloaded is located in the directory the REST call was given.
INFO

To find a folder using the path, the path needs to be URL encoded, (e.g., use %2F for a / and %20 for a ' ' (space).)

Backup-ignoreDependencies#

  • Description - Allows for backing up a project where the data sources (for example) are not contained within the same folder as the rest of the project.
  • URI Syntax - curl -u <username>:<password> -X GET -o <name>.zip 'http://<SpectrumServer>:<port>/api/filesystem/folders/<folderPath>||<UUID>||<file-id>/backup?ignoreMissingDependencies'
  • Example Response - No confirmation/response

Backup-Skip#

  • Description - Disregards entities where dependencies are contained outside of the folder to backup, these files aren't written to the zip file.
  • URI Syntax - curl -u <username>:<password> -X GET -o <name>.zip 'http://<SpectrumServer>:<port>/api/filesystem/folders/<folderPath>||<UUID>||<file-id>/backup?skipFilesWithMissingDependencies'
  • Example Response - No confirmation/response

Migrate/Restore a Folder from a ZIP File#

  • Request Method - PUT
  • Description - Uploads the folder and all its contents including sub-folders and their contents.
  • URI Syntax - curl -u <username>:<password> -X PUT --data-binary @<pathToZipFile> -H 'Content-Type: application/zip' 'http://<SpectrumServer>:<port>/api/filesystem/folders/<folderPath>||<UUID>||<file-id>/restore'
  • Verification - The ZIP file downloaded is located in the directory the REST call was given.
  • Restriction & Notes
    • When creating a backup, all dependencies need to be located within the folder being backed up, otherwise an error occurs.
    • Within the zip file, all JSONs must use Spectrum specific endings (e.g., .imp, .dst, NOT .json).
    • If the contents of the zip file are present in the target location, the restore action will fail.
    • When restoring the contents of a zip file, the uploader becomes the OWNER of the files, with default permissions.
    • If a folder is specified by folder path but the folder doesn't exist, that folder is created and retains the user's capabilities and permissions.
Info

To find a folder using the path, the path needs to be URL encoded, (e.g., use %2F for a / and %20 for a ' ' (space).)

Restore-Overwrite#

  • Description - Replaces and overwrite files that might be located within the target folder in the target system. Existing configurations with downstream dependencies cannot be overwritten.

    Overwrite functions adhere to the user’s existing permission settings. If a user has the capability to overwrite Hadoop properties, they will be overwritten, otherwise not.

  • URI Syntax - curl -u <username>:<password> -X PUT --data-binary @<pathToZipFile> -H 'Content-Type: application/zip' 'http://<SpectrumServer>:<port>/api/filesystem/folders/<folderPath>||<UUID>||<file-id>/restore?overwrite'

Restore-Skip#

  • Description - If the dependencies of a file can't be resolved, the file is ignored and the REST response includes the skipped files.
  • URI Syntax - curl -u <username>:<password> -X PUT --data-binary @<pathToZipFile> -H 'Content-Type: application/zip' 'http://<SpectrumServer>:<port>/api/filesystem/folders/<folderPath>||<UUID>||<file-id>/restore?skipFilesWithMissingDependencies'