Documentation Center

Get assets

Get the contents of the assets corresponding to multiple resources in a single archive.

For security reasons, you need to perform a Login action before making any other public calls to the WorldServer API. The sessionId in the response is your session token. Use this token in all the other calls that you make.

Also, make sure that you have the appropriate user type permissions to perform this API call. To view or update your permissions, in WorldServer, go to Management > User Setup > User Types, and then select your user type.

Prerequisites

To get the contents of the assets, you need to find out the IDs of the resources to which those assets belong. For example, if the assets belong to tasks, you need to make a GET call to the /tasks endpoint.

API call

<protocol>://<ws-host>:<ws-port>/ws-api/v1/files/assets?token=<sessionId>&resourceIds=<resourceId1,resourceId2>

Details

  • GET method
  • Content-Type in the header: application/json
  • Mandatory parameters: the session token (as a query string parameter or as a key-value pair in the header) and the resourceIds (as a query string parameter)

Available filters

You can add the filters as query string parameters or as key-value pairs in the header:
FilterDescription
assetLocationType=<value>One of SOURCE, TARGET, or SOURCE_TARGET. The default value is SOURCE.
resourceType=<value>One of TASK, PROJECT, or PROJECT_GROUP. The default value is TASK.
Examples:
  • <protocol>://<ws-host>:<ws-port>/ws-api/v1/files/assets?token=<sessionId>&resourceIds=<resourceId1,resourceId2>&assetLocationType=SOURCE
  • <protocol>://<ws-host>:<ws-port>/ws-api/v1/files/assets?token=<sessionId>&resourceIds=<resourceId1,resourceId2>&resourceType=PROJECT

Response

The requested assets as an archive (200 OK).

Error messages

MessageStatus code
No assets have been found (If none of the resourceIds were found, if no assets are available, or if the target assets cannot be downloaded.)400 Bad Request
Source asset is not available for download (If resourceType=TASK, but at least one of the resourceIds is not the ID of a task.)400 Bad Request
No session token provided or invalid token401 Unauthorized
Resource PROJECT_GROUP (ID) not found (If resourceType=PROJECT_GROUP, but at least one of the resourceIds is not the ID of a project group.)404 Not Found
Resource PROJECT (ID) not found (If resourceType=PROJECT, but at least one of the resourceIds is not the ID of a project.)404 Not Found
Internal Server Error:
  • If the value of one or more resourceIds is not a number.
  • If the value of the assetLocationType is not SOURCE, TARGET, or SOURCE_TARGET.
  • If the value of the resourceType is not PROJECT, TASK, or PROJECT_GROUP.
500 Internal Server Error