Documentation Center

Get asset

Get the contents of the asset corresponding to a given resource.

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 an asset, you need to find out the ID of the resource to which that asset belongs. For example, if the asset belongs to a task, you need to make a GET call to the /tasks endpoint.

API call

<protocol>://<ws-host>:<ws-port>/ws-api/v2/files/asset?token=<sessionId>&resourceId=<resourceId>

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 resourceId (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/v2/files/asset?token=<sessionId>&resourceId=<resourceId>&assetLocationType=SOURCE
  • <protocol>://<ws-host>:<ws-port>/ws-api/v2/files/asset?token=<sessionId>&resourceId=<resourceId>&resourceType=PROJECT

Response

The contents of the file (200 OK).

Error messages

MessageStatus code
Target asset is not available for download (If you request the target asset, but the project has not been translated.)400 Bad Request
Source asset is not available for download (If resourceType=TASK, but the value of the resourceId is not the ID of a task. Also, if the resource ID is not found.)400 Bad Request
No session token provided or invalid token401 Unauthorized
Resource PROJECT_GROUP (ID) not found (If resourceType=PROJECT_GROUP, but the value of the resourceId is not the ID of a project group.)404 Not Found
Resource PROJECT (ID) not found (If resourceType=PROJECT, but the value of the resourceId is not the ID of a project.)404 Not Found
Internal Server Error:
  • If the value of the resourceId 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