Copy an app

This call copies the specified app to the specified project. The app should be one in a project that you can access; this could be an app that has been uploaded to the Seven Bridges Platform by a project member, or a publicly available app that has been copied to the project.

Request

https://api.sbgenomics.com/v2/apps/{app_id}/actions/copy
https://eu-api.sbgenomics.com/v2/apps/{app_id}/actions/copy

👍

app_ids

Recall from the apps section in the API overview that the app_id has the form {project_owner}/{project}/{app_short_name}/{revision_number}.

Note that if you omit the revision_number, the API will use the latest app revision.

You can get the app_id for an app by making the call to list all apps available to you

Example request

POST /v2/apps/RFranklin/my-project/bamtools-merge-2-4-0/0/actions/copy HTTP/1.1
Host: api.sbgenomics.com
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74
curl --data '{"project": "RFranklin/my-project", "name": "new app name"}'  -s -H "X-SBG-Auth-Token: 7942f56901534434a054dafc3813bc96" -H "content-type: application/json" -X POST "https://api.sbgenomics.com/v2/apps/RFranklin/sandbox/delly2-workflow/actions/copy"
from sevenbridges import Api, AppCopyStrategy

api = Api(url='https://api.sbgenomics.com/v2',
          token='3259c50e1ac5426ea8f1273259740f74')

app = api.apps.get(id='RFranklin/my-project/bamtools-merge-2-4-0/0')

# send POST request to SB API
new_app = app.copy(
    project='rfranklin/my-project',
    name='new app name',
    strategy=AppCopyStrategy.DIRECT
)

print(new_app.name, new_app.id)

Header Fields

Name

Description

X-SBG-Auth-Token
required

Your Seven Bridges Platform authentication token.

Path parameters

Name

Description

app_id

The ID for the app you are copying. It can be obtained by making the call to list all apps available to you

Query parameters

Name

Data type

Description

fields

string

Selector specifying a subset of fields to include in the response.

Request body

The body should contain the following key-value pairs:

Key

Datatype of value

Description of value

"project"
required

string

The name of the project you want to copy the app to

"name"

string

The new name the app will have in the target project. If its name will not change, omit this key.

"strategy"

string

The method for copying the app

clone : copy all revisions; get updates from the same app as the copied app (default)
direct: copy latest revision; get updates from the copied app
clone_direct: copy all revisions; get updates from the copied app
transient: copy latest revision; get updates from the same app as the copied app

Methods for copying an app

The copy strategy parameter defines:

  • Which revisions are copied over into the new app. Either all revisions are copied (methods clone and clone_direct) or only the latest revision is copied (methods direct and transient)
  • The behavior when checking for updates. This is only relevant for apps that are already copies of another app.

For example:

An app called “Vardict Somatic Calling” is available in the Public apps gallery on the Platform. Let’s call this app the original app. At some point another user creates a copy of the Vardict Somatic Calling (original app). Let’s call this copy a source app and let’s say the user renamed it to "Vardict Somatic Calling - copy". Then, you make your copy of "Vardict Somatic Calling - copy" (source app).

You can set your app to receive updates in one of the following two ways::

  • From Vardict Somatic Calling (original app) using methods clone and transient
  • From Vardict Somatic Calling - copy (source app) using methods direct and clone_direct

copy latest revision

copy all revisions

get updates from original app

transient

clone

get updates from source app

direct

clone_direct

Example request body

{
  "project": "rfranklin/my-project", 
  "name": "new app name",
  "strategy": "direct"
}

Response

See a list of Seven Bridges Platform-specific response codes that may be contained in the body of the response.

Example response body

This call returns the full Common Workflow Language (CWL) description of the copied app. This is typically a lengthy JSON object; for conciseness, we have not included it here, but made it available on this page.