1.8 Alpha2 PUT library/{mediaID} - Name Problem

While trying to use PUT api/library/{mediaID} we run into this error:

The name must be between 1 and 100 characters

with the following code from Postman:

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->addForm(array(
  'client_id' => '2OJs5SjIfFBMcPFwLbCP67yT9nE1swtOHPvqinxS',
  'client_secret' => 'WZOJlKEuB4imtfpFbgh2aKDn1hg8YjPqZRrKkNVrigHaGRbRZV522FUN0sjO8Rjz5IHrGyv2JFKDx95xgk0r12dGjDdCgVEDaiNpFAinYYNLJhJssYdnJidRd4mXBuGO2f0NhTBmvWuGGR7vkv8AnX7TDD8gcfeFFY0nqNDrWOTf91aDoFrJGxKBFVPTgl3N2qZq9ShdwU81YSBoSoPepX0c1EVAAo1otAWhoc0cOJyvZpgvHAk0Syg9jWMRBn',
  'grant_type' => 'client_credentials',
  'name' => '1_images.jpg',
  'duration' => '10',
  'retired' => '0',
  'tags' => '1',
  'updateInLayouts' => '1'
), NULL);

$request->setRequestUrl('https://ABC123.com/xibo18alpha/web/api/library/64');
$request->setRequestMethod('PUT');
$request->setBody($body);

$request->setQuery(new http\QueryString(array(
  'name' => '1_images.jpg',
  'duration' => '10',
  'retired' => '0',
  'tags' => '1',
  'updateInLayouts' => '1'
)));

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'authorization' => 'Bearer Bp572ynomQGfX7k67dw7LujScZJ97LPiJlA14v14'
));

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();

As I understand it, PUT requests should use x-www-form-urlencoded as form-data is intentionally disabled by PHP

Ahhhh… You are correct, as always :smiley:.

Thank you Dan, I look forward to the tags working.

1 Like