} catch (\Productsup\Exceptions\ClientException $e) { // Most likely some of the data you provided was malformed // The error codes follow http status codes, @see http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_Client_Error // The message may give more information on what was wrong: echo $e->getCode() . ' ' . $e->getMessage(); } catch (\Exception $e) { // Exceptions not within the Productsup namespace are not thrown by the client, so these exceptions were most likely // thrown from your application or another 3rd party application // however, if you don't catch Productsup exceptions explicitly, you can catch them all like this echo $e->getCode() . ' ' . $e->getMessage(); throw $e; } /** * Get list of projects in your account */ $projects = $Projects->get(); echo 'all projects belonging to the identified client: ' . PHP_EOL; foreach ($projects as $Project) { echo sprintf('%s: %s', $Project->id, $Project->name) . PHP_EOL; } /** * Create a new project * * A new project only needs a title **/ $Project = new Productsup\Platform\Project(); $Project->name = "Testproject " . uniqid(); $NewProject = $Projects->insert($Project); echo 'inserted a new project, and got as result: ' . PHP_EOL; print_r($NewProject); $insertedId = $NewProject->id;