Tips and Tricks

Adding Files When Creating a Job

The file should be added to the body of the request as a binary attachment. Please make sure you have correctly inserted the Memsource and the Content-Disposition headers. Below you can find the sample PHP from Postman.

<?php

$request = new HttpRequest();
$request->setUrl('https://cloud.memsource.com/web/api2/v1/projects/%7BUID%20of%20your%20project%7D/jobs');
$request->setMethod(HTTP_METH_POST);

$request->setQueryData(array(
'token' => 'Your token goes here'
));

$request->setHeaders(array(
'postman-token' => 'ABC',
'cache-control' => 'no-cache',
'content-disposition' => 'filename*=UTF-8''Sample.txt',
'memsource' => '{\\"targetLangs\\":[\\"de\\",\\"fr\\",\\"es\\"],\\"callbackUrl\\":\\"https://my-shiny-service.com/consumeCallback\\",\\"importSettings\\":{\\"uid\\":\\"WF0T1SfSHxII09yKr0dZh9\\"}}'
));

try {
$response = $request->send();

echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}