Ajouter un contact
- Home
- Ajouter un contact
Ajouter un contact
URL
POST http://api.smspartner.fr/v1/contact/add
Paramètres
Chaque demande d’API prend en charge les paramètres suivants :
apiKey | Clé API de votre compte. Vous l’obtenez dans votre compte SMS Partner. |
---|---|
phoneNumber | Numéro de téléphone du contact.
Pour l’envoi de plusieurs SMS les numéros doivent être séparés par des virgules. Ils peuvent être :
|
Paramètres optionnels | |
firstname | Prénom (32 caractères maximum) |
lastname | Nom (32 caractères maximum) |
date | Date au format YYYY-MM-DD. Pourra être utilisé pour des envois automatique (ex: anniversaire ) |
url | Url , elle doit commencer par http:// ou https:// |
custom1 | Champ personnalisé 1 |
custom2 | Champ personnalisé 2 |
custom3 | Champ personnalisé 3 |
custom4 | Champ personnalisé 4 |
Requête
Exemple de requête :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<span style="font-weight: 400;">curl --location --request POST 'http://api.smspartner.fr/v</span><span style="font-weight: 400;">1</span><span style="font-weight: 400;">/contact/add' \</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;">--header 'Content-Type: application/json' \</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;">--data-raw '{</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "apiKey": </span><span style="font-weight: 400;">"YOUR_API_KEY"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "groupId": </span><span style="font-weight: 400;">"ID GROUP"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "contact":{</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "phoneNumber": </span><span style="font-weight: 400;">"xxxxxxxxx"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "firstname": </span><span style="font-weight: 400;">"prénom"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "lastname": </span><span style="font-weight: 400;">"nom"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "date": </span><span style="font-weight: 400;">"YYYY-MM-DD"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "shortUrlPartnr": </span><span style="font-weight: 400;">"http://"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "url": </span><span style="font-weight: 400;">"http://"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "custom1": </span><span style="font-weight: 400;">"custom 1"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "custom2": </span><span style="font-weight: 400;">"custom 2"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "custom3": </span><span style="font-weight: 400;">"custom 3"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "custom4": </span><span style="font-weight: 400;">"custom 4"</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> }</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;">}'</span> |
Réponses
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<span style="font-weight: 400;">{</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "success": </span><span style="font-weight: 400;">true</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "code": </span><span style="font-weight: 400;">200</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "contact": {</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "phoneNumber": </span><span style="font-weight: 400;">"xxxxxxxx"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "firstname": </span><span style="font-weight: 400;">"Prénom"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "lastname": </span><span style="font-weight: 400;">"Nom"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "date": </span><span style="font-weight: 400;">"YYYY-MM-DD"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "shortUrlPartnr": </span><span style="font-weight: 400;">"http://"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "url": </span><span style="font-weight: 400;">"http://"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "custom1": </span><span style="font-weight: 400;">"custom 1"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "custom2": </span><span style="font-weight: 400;">"custom 2"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "custom3": </span><span style="font-weight: 400;">"custom 3"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "custom4": </span><span style="font-weight: 400;">"custom 4"</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> "contactId": </span><span style="font-weight: 400;">"ID CONTACT"</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;"> }</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;">}</span> |
Erreurs
Exemple de message d’erreur :
1 2 3 4 5 |
<span style="font-weight: 400;">{</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;">"success": </span><span style="font-weight: 400;">false</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;">"code": </span><span style="font-weight: 400;">10</span><span style="font-weight: 400;">,</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;">"message": </span><span style="font-weight: 400;">"Clef API incorrecte"</span><span style="font-weight: 400;"> </span><span style="font-weight: 400;">}</span> |
Code de contrôle
Code erreurs | ||
---|---|---|
1 | groupId est requis | |
2 | Contact infos sont requises | |
10 | La Clé API est requise | |
15 | Le numéro est déjà dans le groupe |
© 2019 SMS Partner. Tous droits réservés. Mentions légales