409 Error when calling 'Create a translation file download action'

Hello, I tried calling one of your endpoints and I get a promise resulting in 409 error. My code looks like this:

private async testFunct() {
    const config = {
      headers: {
      'Authorization': `Bearer *mybearertoken*`,
      'content-type': `application/vnd.api+json` }
    };
 
    const bodyParameters = {
      "data": {
          "relationships": {
              "language": {
                  "data": {
                      "id": "l:en_US",
                      "type": "languages"
                  }
              },
              "resource": {
                  "data": {
                      "id": "o:testorgforme:p:testproject-89:r:en-us1json",
                      "type": "resources"
                  }
              }
          },
          "type": "resource_translations_async_downloads"
        }
    };

    try {
      const response = axios.post(
        'https://rest.api.transifex.com/resource_translations_async_downloads',
        bodyParameters,
        config
      );
      console.log(response);
    } catch (error) {
      console.log('problem with axios call: ', error);
    }
  }

In your docs it says “Value some_field_value already exists”. Not sure what to do.

Thank you.

The API endpoint expects a target language since it’s requesting translations. I used the only target language in your project of “fr_FR” instead of en_US, and it worked. Here’s the output…

{ "data": { "id": "1ef02972-59a0-468d-b4f3-649fb7aced68", "type": "resource_translations_async_downloads", "attributes": { "status": "pending", "errors": [], "date_created": "2021-11-16T01:34:58Z", "date_modified": "2021-11-16T01:34:58Z" }, "relationships": { "resource": { "links": { "related": "https://rest.api.transifex.com/resources/o:testorgforme:p:testproject-89:r:en-us1json" }, "data": { "type": "resources", "id": "o:testorgforme:p:testproject-89:r:en-us1json" } }, "language": { "links": { "related": "https://rest.api.transifex.com/languages/l:fr_FR" }, "data": { "type": "languages", "id": "l:fr_FR" } } }, "links": { "self": "https://rest.api.transifex.com/resource_translations_async_downloads/1ef02972-59a0-468d-b4f3-649fb7aced68" } } }

Please give​ it a try and let us know if any further issues.

Regards,
Ryan
Transifex Support