
Anonymous Community User asked a question.
Missing required properties when updating PodioAppField
I want to update a Field in a App. I am using PHP Client for the Podio API. I use PodioAppField::get to get the field specifications. When I use the PodioAppField::update to save the changes function I get an error telling me the required property "Label" is missing. When I checked my $field-object the Label property wasn't missing and has the correct value. Next I tried to update a PodioAppField without changing the field. This also failed with the same error-message. What am I doing wrong? The full error message: Fatal error: Uncaught PodioBadRequestError: "Invalid value {"status": "active", "type": "category", "config": {"default_value": null, "description": null, "settings": {"multiple": false, "options": [{"status": "active", "text": "GRIJS", "id": 1, "color": "DDDDDD"}], "display": "inline"}, "required": false, "mapping": null, "label": "eerstekleur", "visible": true, "delta": 12, "hidden": true, "unique": false}, "field_id": 97337091, "external_id": "eerstekleur"} (object): missing required properties: ['label']" Request URL: http://api.podio.com/app/12724100/field/97337091 Stack Trace: #0 /vagrant/autoniveau.dev/vendor/podio/podio-php/lib/Podio.php(319): Podio::request('PUT', '/app/12724100/f...', Object(PodioAppField)) #1 /vagrant/autoniveau.dev/vendor/podio/podio-php/models/PodioAppField.php(35): Podio::put('/app/12724100/f...', Object(PodioAppField)) #2 /vagrant/autoniveau.dev/public/podio/podio-update-test.php(41): PodioAppField::update(12724100, 97337091, Object(PodioAppField)) #3 {main} thrown in /vagrant/autoniveau.dev/vendor/podio/podio-php/lib/Podio.php on line 253 Code to reproduce the error: ``` // connect $client_id = 'XXX'; $client_secret = 'XXX'; $app_id = 123456789; $username = 'XXX'; $password = 'XXX'; Podio::setup($client_id, $client_secret); Podio::authenticate_with_password($username, $password); // get field_id $app = PodioApp::get((int)$app_id); $app_field_id = $app->fields["myField"]->id; // get field $field = PodioAppField::get((int)$app_id, (int)$app_field_id); // debug echo '<b>$app_id:</b><br>'; echo $app_id; echo '<br>'; echo '<b>$app_field_id:</b><br>'; echo $app_field_id; echo '<br>'; echo '<b>$field:</b><br>'; var_dump($field); echo '<br>'; $field_json = $field->as_json(false); echo '<b>$field_json:</b><br>'; echo var_dump($field_json); echo '<br>'; $field_json_encoded = json_encode($field->as_json(false)); echo '<b>$field_json_encoded:</b><br>'; echo var_dump($field_json_encoded); echo '<br>'; //update field --> error!! PodioAppField::update((int)$app_id, (int)$app_field_id, $field); ```