Welcome, Guest Login

Support Center

How to use Memsource APIs

Last Updated: Dec 04, 2017 06:56PM CET
The below article will provide a simple API scenario with sample API calls and how to chain them together to  complete a simple action using only Memsource APIs. 
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.


Description

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.


Method

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.

Please note that for example "create job" need POST method to send the file in body (not available as GET method).


How to use Postman to test APIs

The attached screenshot demonstrates how to orient yourself in the Postman environment and how to use it to test the API scenario described below.​


Step 1: Authentication

There are 2 possible ways of authentication: 
  1. 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.
  2. 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). 
In this scenario, we will be using the first option using the authentication token. This token is necessary for all the following API calls and will not be listed in the example parameters.

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.


Step 2: Project Creation, Import, Assignment

Projects are created using the api/v3/project/create API call, with mandatory parameters of name, sourceLang & targetLang.
  • 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)
With the UID obtained in the previous call it is now possible to add new Jobs directly into this newly created project using the api/v8/job/create with mandatory parameters of project, targetLang & file.
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:
  1. 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).
  2. Use the api/v3/user/getByUserName API call, with parameter username.
  3. 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)
The JobPart ID is then used in api/v8/job/notifyAssignedLinguist, along with the emailTemplate parameter which represents the ID of the email template that should be used (can be obtained from the Memsource Cloud UI or using the api/v2/emailTemplate/list).
  • EXAMPLE CALL: token=AUTHENTICATION TOKEN&jobPart=62399196&emailTemplate=7303
  • RESPONSE: Empty.
This is where the translator would start to work in his/her account in the same way as if the Memsource Cloud UI was used. After the job is finished, the PM in charge would receive a notification and 3rd part of the scenario can be initiated. It is also possible to wait for a callback (please see more details about webhooks) and initiate the 3rd part automatically, but we are listing only a simple example scenario.

 


Part 3: Project completion, download

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. 
  • EXAMPLE CALL: https://cloud.memsource.com/web/api/v3/project/setStatus?token=AUTHENTICATION TOKEN&project=KmtNyVlz1skQd2aMVEipp7&status=COMPLETED
  • RESPONSE: Empty.
Once the project is completed (or even before) an API call api/v8/job/getCompletedFile with parameter jobPart can be used to retrieve the translated content.
  • EXAMPLE CALL: https://cloud.memsource.com/web/api/v8/job/getCompletedFile?token=AUTHENTICATION TOKEN&jobPart=62399196
  • RESPONSE: Binary response with the completed file itself.

 

support@memsource.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete