Each section includes a link to the precise API call where additional information can be found, as well as a sample API call to illustrate a simple scenario. However, the options that can be set via the APIs are quite extensive. Please consult the respective sections of our API documentation to find more about all the possible options available.
All sample responses include only the information relevant for this scenario; for the complete Response and the range of information it can contain, please refer to our documentation.
To test this scenario, you can use Google Chrome extension (or a separate application) called Postman.
The scenario discussed in this article will cover the following process:
The user will authenticate himself to be able to perform the following action (API equivalent of logging in). The next step will be the creation of a simple project, uploading of jobs, and assignment of a linguist, including an email notification. The actual translation work will be performed outside of the API scenario (in any of the Editors). Once the assignment is finished (Completed by Linguist), the scenario will continue by changing of the Project status to Completed and downloading of the finished document from the project.
Both GET and POST method are supported in Memsource calls, you can choose what is more suitable for you - see general Memsource API User manual.
You can use: GET https://cloud.memsource.com/web/api/v3/project/list?token=lJtc9C8srT....
but also: POST ttps://cloud.memsource.com/web/api/v3/project/list and send the parameters in the body.
Post method can combine parameters in the URL and the body - for example token can be part of the URL and other parameters can be sent in the body.
The attached screenshot demonstrates how to orient yourself in the Postman environment and how to use it to test the API scenario described below.
How to use Postman to test APIs
There are 2 possible ways of authentication:
Step 1: Authentication
- Authentication API call - this call generates an authentication token that is valid for 24 hours. This token then needs to be inserted into all the following API. This validates the users and allows them to perform any other actions in the account.
- oAuth 2.0 - this allows users to validate a certain application in Memsource, which consequently allows its continuous communication with Memsource (without the need for further authentication).
To authenticate yourself, use the api/v3/auth/login API call with appropriate parameters (in this case username and password).
- EXAMPLE CALL: https://cloud.memsource.com/web/api/v3/auth/login?userName=USERNAME&password=PASSWORD
- RESPONSE: Authentication token.
Projects are created using the api/v3/project/create API call, with mandatory parameters of name, sourceLang & targetLang.
Step 2: Project Creation, Import, Assignment
- EXAMPLE CALL: https://cloud.memsource.com/web/api/v3/project/create?token=AUTHENTICATION TOKEN&name=PROJECT&sourceLang=ja&targetLang=en
- RESPONSE: Project UID (e.g. KmtNyVlz1skQd2aMVEipp7)
This call can also include linguist as an optional parameter (used in the example). If this parameter is not included, a separate call (api/v8/job/edit) needs to be used for the purpose of task assignment. The ID of the linguist that is inserted in the call can be obtained in multiple ways:
- While in Memsource Cloud, go to Users and click on the name of the linguist you wish to assign via API. The ID will be a part of the URL displayed in the address bar (e.g. https://cloud.memsource.com/web/user/show/94573).
- Use the api/v3/user/getByUserName API call, with parameter username.
- Use the api/v3/user/list API call. This API call does not require any specific parameters, and it will return a list of all users in the account. The response contains both usernames and IDs.
- EXAMPLE CALL: https://cloud.memsource.com/web/api/v8/job/create?token=AUTHENTICATION TOKEN&targetLang=en&project=KmtNyVlz1skQd2aMVEipp7&linguist=94573
- RESPONSE: JobPart ID (e.g. 62399196)
- EXAMPLE CALL: token=AUTHENTICATION TOKEN&jobPart=62399196&emailTemplate=7303
- RESPONSE: Empty.
Once the job (in this case the only one in the project) is completed, it is possible to use api/v3/project/setStatus with mandatory parameters project and status to change the status of the entire project to completed. This change is a manual one - if Project Status Automation is used, the status will be changed automatically. It is also possible to wait for a webhook and initiate other actions based on the callback received.
Part 3: Project completion, download
- EXAMPLE CALL: https://cloud.memsource.com/web/api/v3/project/setStatus?token=AUTHENTICATION TOKEN&project=KmtNyVlz1skQd2aMVEipp7&status=COMPLETED
- RESPONSE: Empty.
- EXAMPLE CALL: https://cloud.memsource.com/web/api/v8/job/getCompletedFile?token=AUTHENTICATION TOKEN&jobPart=62399196
- RESPONSE: Binary response with the completed file itself.