Publish project
Headers are set up according to Authentification pre-requisite specifications.
Once you have created a HVProject, you can publish it.
Just pass a name and the HVProject id you want to publish to the EndPoint within post parameters.
// Get cURL resource
$curl = curl_init();
// Server EndPoint
$url = 'https://services.adways.com/hv-publish';
$method = 'POST';
$fields = array();
$fields['hv_project'] = $hvProject_id;
$fields['name'] = 'Publication of project: ' . $hvProject_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);
$HVPublish_id = null;
if($curlInfos['http_code'] == 201) {
$HVPublish_id = $response['id'];
}
For more information: API HVPublish