Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • "customerId" : Identifiant SPREAD du profil (valeur à passer dans l'url)
  • "consentId" : Identifiant SPREAD du consentement (valeur à passer en POST)
  • "createdAt" : La date du consentement
  • "customerConsentStatus" : La valeur du consentement. Trois valeurs possibles : "accepted", "refused" ou "unknown". Cette dernière valeur ne fonctionne que s'il existe déjà une valeur pour ce consentement et ce customer.

Paramètres complémentaires :

...

Code Block
languagephp
themeEmacs
$curl_post_data = array(
    'consent' => array(
        "id" => 219259876,
        "createdAt" => "2O18-06-30",
		"customerConsentStatus" => "accepted",
        "ip" => "1.1.1.1" # pas obligatoire
    )
);

$curl_post_data = json_encode($curl_post_data);

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://social-sb.com/api/v2/customers-consents/123456");
curl_setopt($curl, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
//// Auth avec la clé publique et la clé privée (voir dans Paramétrage > Tracker)
curl_setopt($curl, CURLOPT_USERPWD, "clef_public:clef_privee");
curl_setopt($curl, CURLOPT_POSTFIELDS, $curl_post_data );
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_return = curl_exec($curl);
var_dump($curl_return);
curl_close($curl);

...