YAML content format for /resource_strings_async_uploads POST request

Hello, I am making a POST request to /resource_strings_async_uploads to upload a new source file to my resouce which is in YML format.

My question is how I should format my YML content for the request.

I am using the transifex-javascript SDK.

Should the YML content be JSON encoded? i.e.

const ymlFileContents = 'key1:\n  key2: foo\n'
await transifexApi.ResourceStringsAsyncUpload.upload({
  resource: resource,
  content: JSON.stringify(ymlFileContents)  // JSON encoded
});

or should I just send the YML string directly?, i.e.

const ymlFileContents = 'key1:\n  key2: foo\n'
await transifexApi.ResourceStringsAsyncUpload.upload({
  resource: resource,
  content: ymlFileContents  // no JSON.stringify()
});
1 Like