Targeting & Calculation
This request allows you to calculate targeting and its cost.
URL
POST
https://api.smspartner.fr/v1/location/optin
Parameters
apiKey
op
Operation to perform:
calcul
: Calculate the cost and number of contacts matching the targetingprice
: Calculate the cost of targeting onlyrent
: Rent a contact database
parameters
sexe
:
Gender of targeted contacts, must be:
– m
(mixed)
– or h
(male)
– or f
(female)
minAge
:
Minimum age of the target, must be greater than 18.
maxAge
:
Maximum age of the target, must be less than 99.
interest
:
Main category of the target.
subInterest
(optional) :
Subcategory of the main category
category
(optional) :
Socio-professional category:
– 102
: CSP+
– 103
: CSP-
department
(optional) :
List of targeted departments. e.g.: 02,60, etc…
zipcode
(optional) :
List of targeted zip codes. e.g.: 02200,60200, etc…
volumes
This parameter is only available if op = rent or price.
Allows you to choose a desired volume per postal code or department
Requests
<?php
// Prepare data for POST request
$fields = array(
'apiKey'=> 'YOUR API KEY',
'op':'calcul',
'parameters':{
'sexe'=> 'm',
'minAge'=> '25',
'maxAge' => '35',
'zipcode'=> '60200',
'interest'=> 14, /*Habitation*/
'subInterest'=> 35 /*Cuisine*/
},
'volumes':{
'60200':20
}
);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,'https://api.smspartner.fr/v1/location/optin');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS,json_encode($fields));
$result = curl_exec($curl);
curl_close($curl);
// Process your response here
echo $result;
?>
Response
{
"success": true,
"op": "price",
"datas": [
{
"Type": "CP",
"Localite": "06200",
"Volume": 20
},
{
"Type": "total",
"Localite": "total",
"Volume": 20
}
],
"cost": {
"quantity": 20,
"total": 2.52,
"cost_unity": 0.09
}
}
Errors
{
"success": false,
"code": 10,
"message": "Clé API incorrecte"
}
Error Codes
1
API key is required
10
Invalid API key
200
Operation completed
Last updated