Create project

Headers are set up according to Authentification pre-requisite specifications.

In order to create a new project, Media id is not required but is strongly recommanded.

This HVProject creation EndPoint needs a project name, and an optional media id.

On success, you will get a HVProject id.

    // Get cURL resource
    $curl = curl_init();

    // Server EndPoint
    $url = 'https://services.adways.com/hv-project-info';

    $method = 'POST';

    $fields = array();
    $fields['name'] = $hv_project_name;
    $fields['media'] = $adways_media_id;

    $options = array();
    $options[CURLOPT_RETURNTRANSFER] = 1;
    $options[CURLOPT_URL] = $url;
    $options[CURLOPT_SSL_VERIFYPEER] = false;
    $options[CURLOPT_POST] = 1;

    if(!empty($fields)) $options[CURLOPT_POSTFIELDS] = json_encode($fields);

    curl_setopt_array($curl, $options);

    // $access_token: your access token, from your platform
    // X-Token-Provider: to identify the source of the given token
    $headers = array();
    $headers[] = 'Authorization: Bearer ' . $access_token;
    $headers[] = 'X-Token-Provider: ' . $tokenProviderConstant;

    curl_setopt($curl,CURLOPT_HTTPHEADER, $headers);


    // Send the request & save response to $response
    $response = json_decode(curl_exec($curl), true);

    // Save Curl Info request
    $curlInfos = curl_getinfo($curl);

    // Close request to clear up some resources
    curl_close($curl);

    $hvProject_id = null;

    if($curlInfos['http_code'] == 201) {
            $hvProject_id = $response['id'];
    }

For more information: API HVProject