How to use upload.create command?
prolic opened this issue · comments
Sascha-Oliver Prolic commented
I tried several things:
$response = $this->client->request('upload.create', [
'project_id' => $this->projectId,
'locale_id' => $localeId,
'file' => $data, // xml string
'file_format' => 'symfony_xliff',
'tags' => $domain
]);
as well as:
$response = $this->client->request('upload.create', [
'project_id' => $this->projectId,
'locale_id' => $localeId,
'file' => $fileName, // file name on disk
'file_format' => 'symfony_xliff',
'tags' => $domain
]);
and:
$response = $this->client->request('upload.create', [
'project_id' => $this->projectId,
'locale_id' => $localeId,
'file' => '@' . $fileName, // file name on disk
'file_format' => 'symfony_xliff',
'tags' => $domain
]);
But I always receive the response:
Error executing command: Client error response [url] https://api.phraseapp.com/api/v2/projects/<my project id>/uploads [status code] 422 [reason phrase] status code 422
While doing it from linx with curl:
curl -u <my api key>: "https://api.phraseapp.com/api/v2/projects/<my project id>/uploads" -X POST -F file=@/tmp/booking_en.xlf -F file_format=symfony_xliff -F tags=booking -F locale_id=<my locale id>
works just fine, what am I doing wrong? Any help is greatly appreciated!