# Recipe lifecycle management

# Quick reference

Type Resource Description
POST /api/packages/export/:manifest_id Export package based on a manifest.
POST /api/packages/import/:folder_id Import package into a folder.
GET /api/packages/:id Get package by ID.
GET /api/packages/:id/download Download a package.

# Export package based on a manifest

Export package based on a manifest.

POST /api/packages/export/:id

This is an asynchronous request. Use GET package by ID endpoint to get details of the exported package.

# URL parameters

Name Type Description
id string
required
Export manifest ID.

# Sample request

curl  -X POST 'https://www.workato.com/api/packages/export/<manifest_id>' \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>'

# Response

{
   "id":242,
   "operation_type":"export",
   "status":"completed",
   "export_manifest_id":3,
   "download_url":"https://www.workato-staging-assets.com/packages/zip_files/000/000/242/original/exportdemo.zip"
}

# Import package into a folder

Import a package (zip file) into a folder.

POST /api/packages/import/:id

This is an asynchronous request. Use GET package by ID endpoint to get details of the imported the package.

The input (zip file) is a application/octet-stream payload containing package content. URL parameter restart_recipes must be true if the running recipes need to be restarted upon import.

# URL parameters

Name Type Description
id string
required
Folder ID.
restart_recipes boolean
optional
Value must be true to allow the restarting of running recipes during import.
Packages cannot be imported if there are running recipes and this parameter equals false or is not provided.

# Sample request

curl  -X POST 'https://www.workato.com/api/packages/import/<folder_id>?restart_recipes=true' \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>' \
      -H 'Content-Type: application/octet-stream' \
      --data-binary @'path/to/local/file.zip'

# Response

{
   "id":251,
   "operation_type":"import",
   "status":"completed",
   "download_url":"https://www.workato-staging-assets,com/packages/zip_files/000/000/242/original/exportdemo.zip"
}

# Get package by ID

Get details of an imported or exported package.

GET /api/packages/:id

# URL paramters

Name Type Description
id string
required
Package ID.

# Sample request

curl  -X GET 'https://www.workato.com/api/packages/<package_id>' \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>'

# Response

  • This shows the response from the retrieval of a completed export manifest.
{
   "id":242,
   "operation_type":"export",
   "status":"completed",
   "export_manifest_id":3,
   "download_url":"https://www.workato-staging-assets,com/packages/zip_files/000/000/242/original/exportdemo.zip"
}
  • This shows the response from the retrieval of a failed export manifest
{
   "id":242,
   "operation_type":"export",
   "status":"failed",
   "error":"error_message",
   "export_manifest_id":4,
   "download_url":"null"
}
  • This shows the response from the retrieval of a completed import.

NOTE

For any completed import, it is important to also check each recipe's import_result. Learn more about the possible import_result values.

{
   "id":242,
   "operation_type":"export",
   "status":"completed",,
   "download_url":"https://www.workato-staging-assets,com/packages/zip_files/000/000/242/original/importdemo.zip",
   "recipe_status":[
      {
            "id": 12345,
            "import_result": "no_update_or_update_without_restart"
      },
      {
            "id": 12346,
            "import_result": "restarted"
      },
      {
            "id": 12347,
            "import_result": "stopped"
      }
   ]
}
  • This shows the response from the retrieval of a failed import.

NOTE

For any failed import, not all recipes may be returned in recipe_status as they may not have been updated before the import failed. Learn more about the possible import_result values.

{
   "id":242,
   "operation_type":"export",
   "status":"completed",,
   "download_url":"https://www.workato-staging-assets,com/packages/zip_files/000/000/242/original/importdemo.zip",
   "recipe_status":[
      {
            "id": 12345,
            "import_result": "no_update_or_update_without_restart"
      },
      {
            "id": 12346,
            "import_result": "restarted"
      },
      {
            "id": 12347,
            "import_result": "stopped"
      }
   ]
}

# Recipe import_result values

There are a total of 6 possible results:

  1. no_update_or_update_without_restart - This indicates no restart was needed for the recipe. Either recipe could be updated without it or no update was made. Successful import
  2. not_found - Unexpected error when recipe cannot be found. Should not often be seen. Import has failed with no update to recipe.
  3. stop_failed - For recipes that need to be restarted, we attempt to stop the recipe. This state indicates we could not stop the recipe. Import has failed with no update to recipe.
  4. stopped - Workato stopped the recipe but recipe was not restarted due to errors in the recipe. Import has failed with recipe updated but not restarted
  5. restart_failed - Workato attempted to restart recipe but failed to do so. Import has failed with recipe updated but not restarted
  6. restarted - Workato successfully restarted recipe after update. Successful import

# Download package

Downloads a package.

GET /api/packages/:id/download

# URL parameters

Name Type Description
id string
required
Package ID.

# Sample request

curl  -L -X GET 'https://www.workato.com/api/packages/<package_id>/download' \
      -H 'x-user-email: <email>' \
      -H 'x-user-token: <token>'

Follow redirects in cURL

Use the -L flag to follow redirect paths.

# Response

If successful, you will be redirected to the package content. Returns 404 if package not found or doesn't have content.