Solution SMS

Bannière Découvrez Dialog, une exclusivité Primotexto qui va révolutionner votre communication par SMS !

API SMS

Intégrez Primotexto à vos applications grâce à notre puissante API SMS.







Créer une nouvelle liste de contacts  <->   [OPTION] - Ajouter une colonne personalisée à cette liste


Créer une nouvelle liste de contacts

Requête à envoyer

URL

https://api.primotexto.com/v2/lists/

HTTP METHOD

POST

HEADERS

X-Primotexto-ApiKey: YOUR_API_KEY Content-Type: application/json

DATA

{ "name": "Exemple de liste API" }

Retour de l'API


HEADERS

HTTP/1.1 200 OK Date: Fri, 08 Jan 2016 15:11:02 GMT Server: Apache Content-Type: application/json;charset=UTF-8 Vary: Accept-Encoding Transfer-Encoding: chunked

DATA

{ "id": "533e9f59e4b05d2efeb6f1b4" }
C'est l'identifiant de votre liste.
Utilisez celui-ci lors de chaque appel à votre liste.
// Download library -> https://www.primotexto.com/api/librairies/latest-php.asp require_once 'primotexto-api-php/baseManager.class.php'; // Authentication authenticationManager::setApiKey('5a312492501729be484e69bf16064d03'); // Create a list $newList = new PTList(); $newList->name = 'Exemple de liste with fields'; $list = listsManager::addList($newList); $listId = json_decode($list)->id;
curl -X POST \ -H "X-Primotexto-ApiKey: 5a312492501729be484e69bf16064d03" \ -H "Content-Type: application/json" \ -d '{"name":"Exemple de liste with fields"}' \ https://api.primotexto.com/v2/lists/
// Download library -> JDK 1.5 : https://www.primotexto.com/api/downloads/java/primotexto-3.3-jdk-1.5.zip // Download library -> JDK 1.6 : https://www.primotexto.com/api/downloads/java/primotexto-3.3-jdk-1.6.zip // Download library -> JDK 1.7 : https://www.primotexto.com/api/downloads/java/primotexto-3.3-jdk-1.7.zip import com.primotexto.*; // Authentication AuthenticationManager.setApiKey("5a312492501729be484e69bf16064d03"); // Add PTList newList = new PTList(); newList.setName("Exemple de liste with fields"); ListsManager.addList(newList); String listResult = ListsManager.addList(newList); ObjectMapper mapper = new ObjectMapper(); PTList list = mapper.readValue(listResult, PTList.class); String listId = list.getId();



[OPTION] - Ajouter une colonne personnalisée à cette liste

Requête à envoyer

URL

https://api.primotexto.com/v2/lists/533e9f59e4b05d2efeb6f1b2/fields

HTTP Method

POST

HEADERS

X-Primotexto-ApiKey: YOUR_API_KEY Content-Type: application/json

DATA


Exemple d'ajout d'une colonnes: Nom { "name": "Nom", "type": "STRING" }
Type:
"STRING": une chaine de caractère
"DATE": une date (format: dd/MM/yyyy - dd/MM - MM/yyyy)
"BOOLEAN": 0 ou 1
"NUMBER": un nombre

Retour de l'API


HEADERS

HTTP/1.1 200 OK Date: Fri, 08 Jan 2016 15:11:02 GMT Server: Apache Content-Type: application/json;charset=UTF-8 Vary: Accept-Encoding Transfer-Encoding: chunked

DATA

{ "id":"543bda62e4b0275fbfb27aba" }
Identifiant de référence de votre colonne (Nom).
Il sera nécessaire pour l'ajout d'un contact avec une valeur dans la colonne "Nom".

// Download library -> https://www.primotexto.com/api/librairies/latest-php.asp require_once 'primotexto-api-php/baseManager.class.php'; // Authentication authenticationManager::setApiKey('5a312492501729be484e69bf16064d03'); // Create a STRING field on list $newField = new PTField(); $newField->listId= "$listId"; $newField->name = 'Nom de famille'; // Field reference=${nom_de_famille} $newField->type = 'STRING'; $field = ListsManager::addField($newField); $fieldId = json_decode($field)->id; // Create a DATE field on list $newField = new PTField(); $newField->listId= "$listId"; $newField->name = 'Anniversaire'; // Field reference=${anniversaire} $newField->type = 'DATE'; $newField->format = 'dd/MM/yyyy'; // Formats: dd/MM/yyyy,dd/MM,MM/yyyy $field = ListsManager::addField($newField); $fieldId = json_decode($field)->id; //Create a NUMBER field on list $newField = new PTField(); $newField->listId= "$listId"; $newField->name = 'Inscrit'; // Field reference=${inscrit} $newField->type = 'NUMBER'; $field = ListsManager::addField($newField); $fieldId = json_decode($field)->id;
curl -X POST \ -H "X-Primotexto-ApiKey: 5a312492501729be484e69bf16064d03" \ -H "Content-Type: application/json" \ -d '{"name":"Nom","type":"STRING"}' \ https://api.primotexto.com/v2/lists/533e9f59e4b05d2efeb6f1b2/fields
// Download library -> JDK 1.5 : https://www.primotexto.com/api/downloads/java/primotexto-3.3-jdk-1.5.zip // Download library -> JDK 1.6 : https://www.primotexto.com/api/downloads/java/primotexto-3.3-jdk-1.6.zip // Download library -> JDK 1.7 : https://www.primotexto.com/api/downloads/java/primotexto-3.3-jdk-1.7.zip import com.primotexto.*; // Authentication AuthenticationManager.setApiKey("5a312492501729be484e69bf16064d03"); PTField newField = new PTField(); ObjectMapper mapper = new ObjectMapper(); // Create a STRING field on list newField.setListId("listId"); newField.setName("Nom de famille"); // Field reference=${nom_de_famille} newField.setType("STRING"); String field1Result = ListsManager.addField(newField); PTField field1 = mapper.readValue(field1Result, PTField.class); String field1Id = field1.getId(); // Create a STRING field on list newField.setListId("listId"); newField.setName("Anniversaire"); // Field reference=${anniversaire} newField.setType("DATE"); newField.setFormat("dd/MM"); String field2Result = ListsManager.addField(newField); PTField field2 = mapper.readValue(field2Result, PTField.class); String field2Id = field2.getId(); //Create a NUMBER field on list newField.setListId("listId"); newField.setName("INSCRIT"); // Field reference=${inscrit} newField.setType("NUMBER"); String field3Result = ListsManager.addField(newField); PTField field3 = mapper.readValue(field3Result, PTField.class); String field3Id = field3.getId();