Documentation Center

Search for an entry

Search for particular entries using the text string, the source locale, and the target locale as your criteria.

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/tms/search?token=<sessionId>&query=<searchQuery>

The search query should have the following structure: query=text eq 'searched text' and/or source eq 'source locale' and/or target eq 'target locale'

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)
    • the search query (as a query string parameter) that must contain the following: text, source, and target

The following operators are supported: and, or, eq

The following operators are not supported: ne, gt, ge, gte, lt, lte, le, like, in, between

Available filters

You can add the filters as query string parameters or as key-value pairs in the header:
FilterDescription
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.
Example:
  • <protocol>://<ws-host>:<ws-port>/ws-api/v1/tms/search?token=<sessionId>&query=text eq 'you' and source eq 'English (United States)' and target eq 'French (France)' and tm eq '1'
  • <protocol>://<ws-host>:<ws-port>/ws-api/v1/tms/search?token=<sessionId>&query=text eq 'you' or source eq 'English (United States)' and target eq 'French (France)' and tm eq '1'
  • <protocol>://<ws-host>:<ws-port>/ws-api/v1/tms/search?token=<sessionId>&query=text eq 'you' and source eq 'English (United States)' and target eq 'French (France)' and tm eq '1'&limit=2&fields=score

Response

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

Error messages

MessageStatus code
The limit is not valid (It should be greater than or equal to 1.)400 Bad Request
The offset is not valid (It should be greater than or equal to 1.)400 Bad Request
Offset out of range. Collection has only n items (If offset value is greater than n.)400 Bad Request
No session token provided or invalid token401 Unauthorized
Invalid WSQL: Required filter for field text not defined500 Internal Server Error
Invalid WSQL: Required filter for field source not defined500 Internal Server Error
Invalid WSQL: Required filter for field target not defined500 Internal Server Error
Invalid WSQL: Unsupported operator ne for field text provided. Expected eq500 Internal Server Error
No enum constant com.sdl.lt.worldserver.model.filter.LogicalRequestFilter.FilterOperator.you (If the text you searched for contains an apostrophe. The encoded value for the apostrophe does not work either.)500 Internal Server Error