Pushing HTML files for automatic Project creation in Trados

Please see case CS0050244

This particular query concerns sending HTML files to Trados to automatically create a project using a certain template. We extract HTML files from an email campaign site and inject the translated versions back for automated population. The missing link to fully automate our workflow is getting Trados to automatically create a project with SDLXLIFF files. 

Parents Reply Children
  • Hello Emanuel, 

    After review of the solutions sent it seems a looking for something a little bit different. I am not trying to automate the local desktop client. I am building a cloud-to-cloud integration using the Trados Language Cloud REST API, but your EU server (eu.cloud.trados.com) is returning a 500 Internal Server Error for my Tenant ID. 

  • Hello Jose,

    I think you should look into the Postman collection for the API:

    Trados Cloud Platform APIs for Postman

    You will need to

    1. have one user with API rights
    2. create an API key for this user
    3. use the API to create a "bearer token" before performing any real action.

    Example:

    private async Task<string> GetBearer()
    {
    var options = new RestClientOptions("">sdl-prod.eu.auth0.com")
    {
    Timeout=new TimeSpan(1,0,0,0)
    };
    var client = new RestClient(options);
    var request = new RestRequest("/oauth/token", Method.Post);
    request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
    request.AddHeader("Cookie", [check your own cookie value using Postman]);
    request.AddParameter("client_id", [as created with your API key]);
    request.AddParameter("client_secret", [as created with your API key]);
    request.AddParameter("grant_type", "client_credentials");
    request.AddParameter("audience", "">https://api.sdl.com");
    RestResponse response = await client.ExecuteAsync(request);
    return response.Content;
    }

    Call this async Task from somewhere else:

    Token = GetBearer().Result;

    To get project information with given project id:

    private async Task GetProject(string token, string pid)
    {
    var options = new RestClientOptions("">https://lc-api.sdl.com")
    {
    Timeout=new TimeSpan(1,0,0,0)
    };
    var client = new RestClient(options);
    var request = new RestRequest($"/public-api/v1/projects/{pid}", Method.Get);
    request.AddHeader("X-LC-Tenant", [tenant id goes here]);
    request.AddHeader("Accept", "application/json");
    request.AddHeader("Authorization", $"Bearer {token}");
    RestResponse response = await client.ExecuteAsync(request);
    ProjectData = response.Content;
    }

    This example if for reading project information. To create projects:

    Create projects

    Hope this helps!

    Best regards,
    Andreas

  • P.S: No idea why, but it seems this site doesn't like URLs in code. These """>" thingies before https are not supposed to be there. Just the URL itself enclosed in quotes.

  • Hello Andreas,

    Thank you for the Auth0 instructions. We successfully implemented this and are successfully generating the Bearer Token using the client_credentials grant and the https://api.sdl.com audience.

    However, the API backend is still crashing. When we pass this valid Bearer token and our X-LC-Tenant ID (6895c408e91ac77b53d36413) to the projects endpoint, we get the following:

    1. Request to lc-api.sdl.com/.../projects returns 401 Unauthorized.

    2. Request to eu.cloud.trados.com/.../projects returns 500 Internal Server Error.

    Because we are successfully generating the token via Auth0, this 500 error confirms there is a backend routing or database crash occurring on your EU API gateway when it attempts to validate my specific Tenant ID / Service User pairing.

    Please escalate this to check the server crash logs for Tenant 6895c408e91ac77b53d36413

    Best regards

  • Hello Jose,

    I cannot escalate this myself, since I am not an RWS / Trados employee, just a regular LSP guy. :-)

    The 500 error does not necessarily mean that anything crashed, it can also mean that the subsequent request with the bearer token is in some way malformed and cannot be processed.

    Have you tried this directly from code or with Postman? I find Postman an excellent tool to experiment and tinker with API calls - and there is an entire package of Postman scripts bundled for download on the Trados API website.

    That being sad, if you think this is indeed some backend problem, it might be best if you contact support directly.

    Keeping my fingers crossed!

    Best regards,
    Andreas

  • Hello Andreas, 

    Thanks for this idea, I created a x-ray script to analyze the Postman and verify if this was the issue. It is not but it just makes it clearer I need engineering support from RWS. Thanks for sharing your knowledge, have a great day.