Documentation Center

Get projects

Get a list of the projects defined on your system.

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.

API call

<protocol>://<ws-host>:<ws-port>/ws-api/v1/projects?token=<sessionId>

Details

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

Integration tips

For integration purposes, you might want to retrieve information about a limited number of projects or to retrieve information only about the projects that use a certain locale. To achieve this, use the resourceIds or the localeId filters.

Available filters

You can add the filters as query string parameters or as key-value pairs in the header:
FilterDescription
resourceIds=<projectId1,projectId2,…,projectIdN>The IDs of the projects to retrieve, separated by commas.
localeId=<localeId>The locale of the projects that you want to retrieve.
sortBy=<fieldName>Use this filter in conjunction with the fields filter. If the fields you specified for sorting are not available, the results will not be sorted.
sortDirection=<asc|desc>Ascending or descending.
fields=<fieldName1,fieldName2,...,fieldNameN>The names of the fields to be included in the JSON response, separated by commas. Do not use in conjunction with the excludedFields filter.
excludedFields=<fieldName1,fieldName2,…,fieldNameN>The names of the fields to be excluded from the JSON response, separated by commas. Do not use in conjunction with the fields filter.
offset=<number>The zero-based starting index in the entire collection of the first item to return.
limit=<number>The maximum number of collection items to return for a single request. By default, 30. The limit should be greater than or equal to 1.
onlyActive=<true|false>A flag to retrieve only active projects.
Examples:
  • <protocol>://<ws-host>:<ws-port>/ws-api/v1/projects?token=<sessionId>&sortBy=name
  • <protocol>://<ws-host>:<ws-port>/ws-api/v1/projects?token=<sessionId>&sortBy=name&sortDirection=asc
  • <protocol>://<ws-host>:<ws-port>/ws-api/v1/projects?token=<sessionId>&fields=name,description&sortBy=name&sortDirection=asc
  • <protocol>://<ws-host>:<ws-port>/ws-api/v1/projects?token=<sessionId>&excludedFields=name
  • <protocol>://<ws-host>:<ws-port>/ws-api/v1/projects?token=<sessionId>&limit=10&fields=name,creationDate&resourceIds=3346,3347
  • <protocol>://<ws-host>:<ws-port>/ws-api/v1/projects?token=<sessionId>&sortBy=creationDate&onlyActive=true

Advanced filtering

To reduce the amount of data in the result and to improve performance, you can perform the filtering deeper in the project tree structure. For example: <protocol>://<ws-host>:<ws-port>/ws-api/v1/projects?token=<sessionId>&fields=id,targetLocale(id,name,language(id,languageCode))

In this case, the returned JSON contains only the fields you specified for each layer:
  • The ID and the target locale of each project.
  • The ID, the name, and the language model of the target locale.
  • Inside the language model, the ID and the code of the language.
The same logic applies to the excludedFields filter.

Response

A screen shot that shows a typical response to this call.

Error messages

MessageStatus code
Limit not provided, or invalid (It has to be greater than or equal to 1.)400 Bad Request
Offset not provided, or invalid (It has to be greater than or equal to 1.)400 Bad Request
Required filter resourceIds not provided, or invalid (If one of the IDs you entered is not a valid number.) 400 Bad Request
Required filter localeId not provided, or invalid (If one of the IDs you entered is not a valid number.) 400 Bad Request
No session token provided or invalid token401 Unauthorized

Troubleshooting

  • Make sure that the endpoint you are calling is correct.
  • Make sure that you are using the GET method for the call.
  • Make sure that the Content-Type in the header is application/json.
  • Make sure that your session token is correct and that it has not expired.
  • Check the error message. If it indicates an invalid field, make sure you are using valid query string parameters and valid values.