How to create a conversion and the association with a datapoint

To perform this task are necessary two different kind of requests from the “Management-Conversions” API category. The first one creates the conversion, while the second will make the association with a specific datapoint.

 

Usage:

 

  • Create conversion:

$body = array(

'description' => 'Conversion description',

'name' => 'Conversion friendly name'

);

$output = api_request('http://apiv2.clickmeter.com/conversions', 'POST', json_encode($body) , $api_key);

 

  • Associate with a datapoint:

$body = array(

'action' => 'add',

'id' => $datapoint_id

);

$output = api_request('http://apiv2.clickmeter.com/conversions/' . $conversion_id . '/datapoints/patch', 'PUT', json_encode($body) , $api_key);

 

Parameters:

Both requests need a body to carry arguments, in JSON format.

  • Create conversion (POST method):

    • name: the friendly name that will be created for the conversion.

    • description: this field could contain additional information about the conversion.

  • Associate with a datapoint (PUT method):

    • $created_conversion_id: the id of the conversion to associate, passed as parameter in the endpoint URI.

    • action: the same request can be used to “add” or “remove” the association by specifying the desired action.

    • id: the datapoint target id, that will be modified.


Return value:

In both cases, the response body will contain the id of the created conversion.

Have more questions? Submit a request

0 Comments

Article is closed for comments.