Télécharger le fichier
Cette requête permet de télécharger le fichier de la location
URL
GET
https://api.smspartner.fr/v1/location/file/download
Paramètres
Nom
Valeur
apiKey
token
Identifiant de la location.
Requêtes
<?php
// Prepare data for GET request
$data = 'apiKey=YOUR_API_KEY&token=xxx';
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,'https://api.smspartner.fr/v1/location/file/download?'.$data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
$result = curl_exec($curl);
curl_close($curl);
// Process your response here
echo $result;
?>
Imports System.IO
Imports System.Net
Module Module1
Sub Main()
Dim base_url As String = "http://api.smspartner.fr/v1/"
Dim apiKey As String = "VOTRE_APIKEY"
Dim token As String = XXX
#check credits
Dim url As String
url = base_url & "location/file/download" & "?apiKey=" & apiKey & "&token=" & token
Dim credits As String
credits = apiRequest("GET", url, Nothing)
End Sub
Function apiRequest(method As String, url As String, parameters As String) As String
Dim request As HttpWebRequest
request = WebRequest.Create(url)
request.Method = method
request.Timeout = 10000 # timeout in ms
request.ContentType = "application/json; charset=utf-8"
request.ContentLength = 0
#set POST data
If Not String.IsNullOrEmpty(parameters) Then
request.ContentLength = parameters.Length
Using reqStream As StreamWriter = New StreamWriter(request.GetRequestStream())
reqStream.Write(parameters)
End Using
End If
#get response
Dim returnValue As String = Nothing
Using response As HttpWebResponse = request.GetResponse()
If response.StatusCode = HttpStatusCode.OK Then
Using resStream = response.GetResponseStream()
If resStream IsNot Nothing Then
Using reader As New StreamReader(resStream)
returnValue = reader.ReadToEnd()
End Using
End If
End Using
End If
End Using
apiRequest = returnValue
End Function
End Module
# std
import logging
import json
from collections import OrderedDict
# 3p
import requests
API_KEY = "MY API KEY"
URL = "https://api.smspartner.fr/v1"
class SMSPartner():
def get_delivery(self,token):
url = URL + "/location/file/download?apiKey=" + API_KEY + "&token=" + token
r = requests.get(url)
r_json = r.json()
if r_json.get("success") == True:
print(r_json)
status = True
else:
print(r_json)
status = False
return status
curl -H "Content-Type: application/json" -X GET https://api.smspartner.fr/v1/location/file/download?apiKey=xxx&token=xxx
Réponse
{
"success": true,
"phoneNumbers": 10,
"datas": [
{
"id": ...4314,
"phone": "+336XXXXXX",
"stopSms": false
},
{
"id": ...4315,
"phone": "+336XXXXXX",
"stopSms": false
},
{
"id": ...4316,
"phone": "+336XXXXXX",
"stopSms": false
}...
<?xml version='1.0' encoding='UTF-8'?>
<result>
<entry>true</entry>
<entry>10</entry>
<entry>
<entry>
<entry>...4314</entry>
<entry>
<![CDATA[+336XXXXXX]]>
</entry>
<entry>false</entry>
</entry>
<entry>
<entry>...4315</entry>
<entry>
<![CDATA[+33669106211]]>
</entry>
<entry>false</entry>
</entry>
<entry>
<entry>...4316</entry>
<entry>
<![CDATA[+33781609201]]>
</entry>
<entry>false</entry>
</entry>...
Erreurs
{
"success": false,
"code": 10,
"message": "Clé API incorrecte"
}
<?xml version="1.0" encoding="UTF-8"?>
<result>
<entry>false</entry>
<entry>10</entry>
<entry>
<![CDATA[Clé API incorrecte]]>
</entry>
</result>
Code erreurs
Code de réponse
Réponse
1
La Clé API est requise
10
Clé API incorrecte
31
Le token de la location est requis
32
Location introuvable
200
Tout s'est bien passé !
Dernière mise à jour