Versions Compared

Key

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

Méthodes disponibles

...

...

Cette méthode permet de récupérer les informations d'un customer précis.

Paramètres obligatoires :

  • "id" : identifiant SPREAD

Paramètres complémentaires :

Aucun

Réponse :

Si GET ok alors

Code Block
languagephp
themeEmacs
"customer": {
 "id": "123456",
 "lastName": "Doe",
 "firstName": "John",
 "email": "email-example@gmail.com",
 "country": null,
 "city": null,
 "address": null,
 "zip": null,
 "phone": null,
 "mobile": null,
 "lang": "fr",
 "birthday": null,
 "gender": null,
 "createdAt": "2018-04-10T14:15:48+0000",
 "updatedAt": "2018-05-21T14:06:47+0000",
 "isFan": "0",
 "isFollow": "0",
 "isFanLinkedin": "0",
 "isFanGoogle": "0",
 "isMobileOptin": "0",
 "isBuyer": "0",
 "actionCount": "0",
 "lastActionDt": null,
 "lastOrderDt": null,
 "cagnotteAmount": "99"}

Sinon affichage d'un message d'erreur.

Exemple d'appel PHP :

Code Block
languagephp
themeEmacs
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://social-sb.com/api/v2/customers/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_VERBOSE, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_return = curl_exec($curl);
var_dump($curl_return);
curl_close($curl);

...

Permet de récupérer tous les customers de la CRM (pour un site_id)

Paramètres obligatoires : 

Aucun

Paramètres complémentaires :

Aucun

Réponse :

Si GET ok alors

Code Block
languagephp
themeEmacs
"customers": [
 {
 "id": "123456",
 "lastName": "Doe",
 "firstName": "John",
 "email": "email-example@gmail.com",
 "country": null,
 "city": null,
 "address": "chemin Odette Vidal",
 "zip": null,
 "phone": "0235000000",
 "mobile": "0600000000",
 "lang": "fr",
 "birthday": null,
 "gender": "female",
 "createdAt": "2017-04-12T08:10:19+0000",
 "updatedAt": "2017-04-12T10:10:35+0000",
 "isFan": "0",
 "isFollow": "0",
 "isFanLinkedin": "0",
 "isFanGoogle": "0",
 "isMobileOptin": "0",
 "isBuyer": "1",
 "actionCount": "0",
 "lastActionDt": null,
 "lastOrderDt": null,
 "cagnotteAmount": null
 },
 {
 "id": "123457",
 "lastName": "Doe",
 "firstName": "Jane",
 "email": "email-example2@gmail.com",
 "country": null,
 "city": null,
 "address": "157, place de Bouvier",
 "zip": null,
 "phone": "0235100000",
 "mobile": "0620000000",
 "lang": "fr",
 "birthday": null,
 "gender": "male",
 "createdAt": "2017-04-12T08:10:50+0000",
 "updatedAt": "2017-04-12T10:11:03+0000",
 "isFan": "0",
 "isFollow": "0",
 "isFanLinkedin": "0",
 "isFanGoogle": "0",
 "isMobileOptin": "0",
 "isBuyer": "1",
 "actionCount": "0",
 "lastActionDt": null,
 "lastOrderDt": null,
 "cagnotteAmount": null
 }
],
"count": 2,
"nextPageUrl": "http://social-sb.com/api/v2/customers?maxResults=2&startAt=2"

Sinon affichage message d'erreur.

Exemple d'appel PHP :

Code Block
languagephp
themeEmacs
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://social-sb.com/api/v2/customers"); 
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_VERBOSE, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_return = curl_exec($curl);
var_dump($curl_return);
curl_close($curl);

Faire une recherche précise :

Il est possible d'affiner la liste retourner en passant des paramètres GET.

La recherche s'effectuera sur des valeurs strictement égales entre le paramètre GET et les valeurs en base.

Les paramètres d'affinage possibles :

  • "email" ⇒ retournera le customer possédant l'email passé en paramètre s'il existe. social-sb.com/api/v2/contacts?email=example@gmail.com
  • "lastName" ⇒ pour le nom de famille
  • "zipcode" ⇒ retournera tous les customers possédant le code postal passé en paramètre.
  • "phoneNumber" ⇒ pour le téléphone fixe
  • "mobilePhoneNumber" ⇒ pour le téléphone mobile

...

Permet de créer un nouveau customer.

Paramètres obligatoires :

  • "email" : Email du customer à créer (dans le payload "contact")

Paramètres complémentaires :

  • "lastName" : Nom de famille du customer à créer
  • "firstName" : Prénom du customer à créer
  • "country" : Pays
  • "city" : Ville
  • "address" : Adresse du customer à créer. En seul champ
  • "zip" : Code postal
  • "phone" : numéro de téléphone fixe
  • "mobile" : numéro de téléphone mobile
  • "lang" : langue du customer
  • "birthday" : Date d'anniversaire, le format doit être "YYYY-mm-dd"
  • "gender" : Genre du customer. Les valeurs possibles sont "male" ou "female"
  • "isFan" : Est fan de la page Facebook (1 = oui; 0 = non)
  • "isFollow" : Suit la page Twitter (1 = oui; 0 = non)
  • "isFanLinkedin" : Fan de la page Linkedin (1 = oui; 0 = non)
  • "isFanGoogle" : Est fan de la page Google+ (1 = oui; 0 = non)
  • "isOptin" : Si le client est optin (1 = oui; 0 = non; -1 = "unknow")
  • "isMobileOptin" : Si le client est optin SMS (1 = oui; 0 = non; -1 = "unknow")
  • "isBuyer" : Est client (1 = oui, 0 = non)

Réponse :

Si POST ok alors

Code Block
languagephp
themeEmacs
"customer": {
 "id": "123456",
 "lastName": "Doe",
 "firstName": "John",
 "email": "email-example@gmail.com",
 "country": null,
 "city": null,
 "address": null,
 "zip": null,
 "phone": null,
 "mobile": null,
 "lang": "fr",
 "birthday": null,
 "gender": null,
 "createdAt": "2018-04-10T14:15:48+0000",
 "updatedAt": "2018-05-21T14:06:47+0000",
 "isFan": "0",
 "isFollow": "0",
 "isFanLinkedin": "0",
 "isFanGoogle": "0",
 "isMobileOptin": "0",
 "isBuyer": "0",
 "actionCount": "0",
 "lastActionDt": null,
 "lastOrderDt": null,
 "cagnotteAmount": "99"}

Sinon affichage d'un message d'erreur

Exemple d'appel PHP :

Code Block
languagephp
themeEmacs
$curl_post_data = array(
    'customer' => array (
        'email' => 'email-example@sb.am',
        'firstName' => 'John',
        'lastName' => 'Doe'
    )
);

$curl_post_data = json_encode($curl_post_data);

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://social-sb.com/api/v2/customers");
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);

...

Permet d'updater les informations d'un customer

Paramètres obligatoires :

  • "email" : Email du customer à créer (dans le payload "contact")

Paramètres complémentaires :

  • "lastName" : Nom de famille du customer à créer
  • "firstName" : Prénom du customer à créer
  • "country" : Pays
  • "city" : Ville
  • "address" : Adresse du customer à créer. En seul champ
  • "zip" : Code postal
  • "phone" : numéro de téléphone fixe
  • "mobile" : numéro de téléphone mobile
  • "lang" : langue du customer
  • "birthday" : Date d'anniversaire, le format doit être "YYYY-mm-dd"
  • "gender" : Genre du customer. Les valeurs possibles sont "male" ou "female"
  • "isFan" : Est fan de la page Facebook (1 = oui; 0 = non)
  • "isFollow" : Suit la page Twitter (1 = oui; 0 = non)
  • "isFanLinkedin" : Fan de la page Linkedin (1 = oui; 0 = non)
  • "isFanGoogle" : Est fan de la page Google+ (1 = oui; 0 = non)
  • "isOptin" : Si le client est optin (1 = oui; 0 = non; -1 = "unknow")
  • "isMobileOptin" : Si le client est optin SMS (1 = oui; 0 = non; -1 = "unknow")
  • "isBuyer" : Est client (1 = oui, 0 = non)

Réponse :

Si OK alors

Code Block
languagephp
themeEmacs
"customer": {
 "id": "123456",
 "lastName": "Doe",
 "firstName": "John",
 "email": "email-example@gmail.com",
 "country": null,
 "city": null,
 "address": null,
 "zip": null,
 "phone": null,
 "mobile": null,
 "lang": "fr",
 "birthday": null,
 "gender": null,
 "createdAt": "2018-04-10T14:15:48+0000",
 "updatedAt": "2018-05-21T14:06:47+0000",
 "isFan": "0",
 "isFollow": "0",
 "isFanLinkedin": "0",
 "isFanGoogle": "0",
 "isMobileOptin": "0",
 "isBuyer": "0",
 "actionCount": "0",
 "lastActionDt": null,
 "lastOrderDt": null,
 "cagnotteAmount": "99"}

Exemple d'appel PHP :

Code Block
languagephp
themeEmacs
$curl_post_data = array(
    'customer' => array (
        'email' => 'email-example@sb.am',
        'firstName' => 'John',
        'lastName' => 'Doe'
    )
);

$curl_post_data = json_encode($curl_post_data);

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://social-sb.com/api/v2/customers/14764505");
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_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_return = curl_exec($curl);
var_dump($curl_return);
curl_close($curl);

...

Permet de modifier une adresse email.

Paramètres obligatoires :

  • "old_email"
  • "new_email"

Paramètres complémentaires :

Aucun

Réponse :

Si OK alors 

Code Block
languagephp
themeEmacs
"customer": {
 "id": "123456",
 "lastName": "Doe",
 "firstName": "John",
 "email": "email-example@gmail.com",
 "country": null,
 "city": null,
 "address": null,
 "zip": null,
 "phone": null,
 "mobile": null,
 "lang": "fr",
 "birthday": null,
 "gender": null,
 "createdAt": "2018-04-10T14:15:48+0000",
 "updatedAt": "2018-05-21T14:06:47+0000",
 "isFan": "0",
 "isFollow": "0",
 "isFanLinkedin": "0",
 "isFanGoogle": "0",
 "isMobileOptin": "0",
 "isBuyer": "0",
 "actionCount": "0",
 "lastActionDt": null,
 "lastOrderDt": null,
 "cagnotteAmount": "99"}

Exemple d'appel PHP

Code Block
languagephp
themeEmacs
$curl_post_data = array(
    'customer' => array (
        'old_email' => 'oldemail@gmail.com',
        'new_email' => 'newemail@gmail.com'
    )
);

$curl_post_data = json_encode($curl_post_data);

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://social-sb.com/api/v2/customers/email/update");
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_CUSTOMREQUEST, "PUT");
curl_setopt($curl, CURLOPT_VERBOSE, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_return = curl_exec($curl);
var_dump($curl_return);
curl_close($curl);

Méthodes disponibles

...

Anchor
getconsent
getconsent
GET ⇒ social-sb.com/api/v2/consents/{id}

Récupère les valeurs d'un consentement

Paramètres obligatoires :

  • "id" : l'identifiant SPREAD du consentement

Paramètres complémentaires :

Aucun

Réponse :

Si GET ok alors

Code Block
languagephp
themeEmacs
"consent": 
{ 
"id": "9876", 
"consentType": "Default newsletter", 
"consentName": "Informations commerciales par email", 
"consentTechName": "NewsEmail", 
"createdAt": "2018-02-07T10:24:34+0000", 
"updatedAt": "2018-04-05T13:33:31+0000" 
}

Sinon affichage d'un message d'erreur

Exemple d'appel PHP :


Code Block
languagephp
themeEmacs
$curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://social-sb.com/api/v2/consents/9876"); 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_VERBOSE, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $curl_return = curl_exec($curl); var_dump($curl_return); curl_close($curl);

Anchor
getconsents
getconsents
GET ⇒ social-sb.com/api/v2/consents

Récupère les valeurs de tous les consentements d'un site_id

Paramètres obligatoires :

Aucun

Paramètres complémentaires :

Aucun

Réponse :

Si GET ok alors

Code Block
languagephp
themeEmacs
"consents": [ 
{ 
"id": "9876", 
"consentType": "Default phone", 
"consentName": "Informations commerciales par t\u00e9l\u00e9phone", 
"consentTechName": "J'accepte d'\u00eatre contact\u00e9 occasionnellement par t\u00e9l\u00e9phone", 
"createdAt": "2018-02-07T10:24:34+0000", 
"updatedAt": "2018-02-07T10:24:34+0000" 
}, 
{ 
"id": "9875", 
"consentType": "Legal basis legitimate interest", 
"consentName": "Opt-in email", 
"consentTechName": "LegalBasisOptin", 
"createdAt": "2018-04-25T21:42:26+0000", 
"updatedAt": "2018-04-25T21:42:26+0000" 
}, 
{ 
"id": "9874", 
"consentType": "Legal basis legitimate interest", 
"consentName": "Opt-in sms", 
"consentTechName": "LegalBasisOptin",  
"createdAt": "2018-04-25T21:42:26+0000", 
"updatedAt": "2018-04-25T21:42:26+0000" 
}, 
{ 
"id": "9873", 
"consentType": "Legal basis contract", 
"consentName": "Commande", 
"consentTechName": "LegalBasisOrder", 
"createdAt": "2018-04-25T21:42:26+0000", 
"updatedAt": "2018-04-25T21:42:26+0000" 
}, 
{ 
"id": "9872", 
"consentType": "Legal basis contract", 
"consentName": "Inscription", 
"consentTechName": "LegalBasisSignup", 
"createdAt": "2018-04-25T21:42:26+0000", 
"updatedAt": "2018-04-25T21:42:26+0000" 
}, 
{ 
"id": "9871", 
"consentType": "Default newsletter", 
"consentName": "Informations commerciales par email",  
"consentTechName": "NewsEmail", 
"createdAt": "2018-02-07T10:24:34+0000", 
"updatedAt": "2018-04-05T13:33:31+0000" 
}, 
{ 
"id": "9870", 
"consentType": "Default SMS", 
"consentName": "Informations commerciales par SMS", 
"consentTechName": "NewsSMS",  
"createdAt": "2018-02-07T10:24:34+0000", 
"updatedAt": "2018-02-07T10:24:34+0000" 
} 
], 
"count": 7, 
"nextPageUrl": "http://social-sb.com/api/v2/consents?startAt=7"

Sinon affichage d'un message d'erreur

Exemple d'appel PHP :




Code Block
languagephp
themeEmacs
$curl = curl_init(); curl_setopt($curl, CURLOPT_URL, "https://social-sb.com/api/v2/consents"); 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_VERBOSE, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $curl_return = curl_exec($curl); var_dump($curl_return); curl_close($curl);


Faire une recherche précise :


Il est possible d'affiner la liste retournée en passant des paramètres GET.

Les paramètres d'affinage possibles :

  • "createdAfter" ⇒ seuls les consentements créés après la date passée en paramètre seront remontés

  • "createBefore" ⇒ seuls les consentements créés avant la date passée en paramètre seront remontés

  • "modifiedAfter" ⇒ seuls les consentements modifiés après la date passée en paramètre seront remontés

  • "modifiedBefore" ⇒ seuls les consentements modifiés avant la date passée en paramètre seront retournés

Les paramètres sur la pagination :

  • "startAt" ⇒ permet de commencer la liste des consentements à partir de l'occurence passée en paramètre

  • "maxResult" ⇒ permet de limiter le nombre de consentements remontées par pages (max 5000)