API: UpdateCustomAttribute: Slim Application Error

Community Support for Booked Scheduler
Post Reply
barrisa
Posts: 1
Joined: Thu Jul 30, 2020 7:53 pm

API: UpdateCustomAttribute: Slim Application Error

Post by barrisa »

Hello all,
I am currently running Booked 2.7.8 ontop of PHP 5.4.16 on RHEL 7.7.
I am trying to set up a method of updating an attribute's 'possibleValues' field using a bash script (curl) and the Booked API, but keep getting this error:
Slim Application Error: The application could not run because of the following error: Code: Message: trim() expects parameter 1 to be string, array given File: /var/www/html/booked-2.7.8/Domain/CustomAttribute.php Line 477

The command I have executed is:

Code: Select all

$ curl -k -d '{"label":"Release","type":"3","categoryId":"1","regex":"","required":"1","possibleValues":["entry1","entry2"],"sortOrder":1,"appliesToIds":[],"adminOnly":0,"isPrivate":false,"secondaryCategoryId":null,"secondaryEntityIds":[]}' -H "Context-Type: application/json" -H "X-Booked-SessionToken: [session-token]" -H "X-Booked-UserId: [userID]" -X POST https://localhost/booked/Web/Services/index.php/Attributes/4
What is weird is when I don't supply the '4' at the end of the URL, it creates a new attribute perfectly fine. Am I doing something wrong?

Stack:

Code: Select all

#0 [internal function]: Slim\Slim::handleErrors(2, 'trim() expects ...', '/var/www/html/b...', 477, Array)
#1 /var/www/html/booked-2.7.8/Domain/CustomAttribute.php(477): trim(Array)
#2 /var/www/html/booked-2.7.8/Domain/CustomAttribute.php(324): CustomAttribute->SetPossibleValues(Array)
#3 /var/www/html/booked-2.7.8/WebServices/Controllers/AttributeSaveController.php(141): CustomAttribute->__construct('4', 'Release', '3', '1', '', '1', Array, 1, Array, 0)
#4 /var/www/html/booked-2.7.8/WebServices/AttributesWriteWebService.php(99): AttributeSaveController->Update('4', Object(stdClass), Object(WebServiceUserSession))
#5 [internal function]: AttributesWriteWebService->Update('4')
#6 /var/www/html/booked-2.7.8/lib/external/Slim/Router.php(200): call_user_func_array(Array, Array)
#7 /var/www/html/booked-2.7.8/lib/external/Slim/Slim.php(1218): Slim\Router->dispatch(Object(Slim\Route))
#8 /var/www/html/booked-2.7.8/lib/external/Slim/Middleware/Flash.php(86): Slim\Slim->call()
#9 /var/www/html/booked-2.7.8/lib/external/Slim/Middleware/MethodOverride.php(94): Slim\Middleware\Flash->call()
#10 /var/www/html/booked-2.7.8/lib/external/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#11 /var/www/html/booked-2.7.8/lib/external/Slim/Slim.php(1167): Slim\Middleware\PrettyExceptions->call()
#12 /var/www/html/booked-2.7.8/Web/Services/index.php(85): Slim\Slim->run()
If you need any more information please ask. Thanks!

Post Reply