*/
$Project = new \Productsup\Platform\Project();
$Project->id = 9659;
$Sites->setProject($Project);
$SiteList = $Sites->get();
echo 'Getting a site list for a certain project' . PHP_EOL;
print_r($SiteList);
/**
 * to insert one project, you need a reference to the project
 * you can also create a new one:
 */
// creating the project
$projectObject = new \Productsup\Platform\Project();
$projectObject->name = 'example project ' . date('Y-m-d H:i:s');
$Projects = new \Productsup\Service\Projects($Client);
$newProject = $Projects->insert($projectObject);
// create the service and reference the project
$SitesService = new \Productsup\Service\Sites($Client);
$SitesService->setProject($newProject);
$siteObject = new \Productsup\Platform\Site();
$siteObject->title = 'new example site';
/**
 * if you want to reference the project from now on with your identifier,
 * you can create a reference while inserting:
 *
 * note: references have to be unique,
 * if you try to add a reference that already exists you will receive an conflict exception
 */
$reference = new \Productsup\Platform\Site\Reference();
$reference->setKey('MyTestReference');
$reference->setValue(uniqid());
/**
 * Authentication
 *
 * You'll get the client id and secret at the plaform (API Access)
 **/
$Client = new Productsup\Client();
$Client->id = 1234;
$Client->secret = 'simsalabim';
/**
 * first we need a project and a site which should be tagged,
 * for further explanation see the examples in Projects.php and Sites.php
 */
$project = new \Productsup\Platform\Project();
$project->name = 'test ' . date('Y-m-d H:i:s');
$projectService = new \Productsup\Service\Projects($Client);
$project = $projectService->insert($project);
$site = new \Productsup\Platform\Site();
$site->domain = 'test_' . date('Ymdhis') . '.tld';
$site->project_id = $project->id;
$sitesService = new \Productsup\Service\Sites($Client);
$site = $sitesService->insert($site);
/**
 * if you want to tag your site to later reference it by this tag instead of remembering the provided site_id
 * you can insert it like this
 *
 * note: a tag needs a key and a value, the key is the tags name (e.g. "myidentifier") and value it's value (e.g. "321")
 */
$tag = new \Productsup\Platform\Tag();
$tag->key = 'myidentifier';
$tag->value = '321';
$tagService = new \Productsup\Service\Tags($Client);
 * Create a new project (Projects->insert())
 * Delete a project (and all related sites) (Projects->delete())
 * Get a list of sites (Projects->get())
 */
$Projects = new Productsup\Service\Projects($Client);
/* Override the host to test on development instance */
// $Projects->host = 'local.api.productsup.com';
/**
 * Create a new project
 *
 * A new project only needs a title
 **/
$Project = new Productsup\Platform\Project();
$Project->name = "Testproject " . uniqid();
try {
    $NewProject = $Projects->insert($Project);
} catch (\Productsup\Exceptions\ServerException $e) {
    // A exception at the API Server happened, should not happen but may be caused by a short down time
    // You may want to retry it later, if you keep getting this kind of exceptions please notice us.
    throw new Exception('Error at the productsup API, retry later');
} 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;