Få SMS-leveransstatus med Python
Få SMS-leveransstatus med Python
Python : API-DOKUMENTATION
- Skapa grupp med Python
- Hämta gruppfältlista med Python
- Lägg till ett fält i en grupp med Python
- Radera ett fält från en grupp med Python
- Radera en kontakt från en grupp
- Assistera land till e-grupp med Python
- Hämta gruppkontaktlista med Python
- Lägg till kontakt i en grupp med Python
- Ändra kontakt med en grupp med Python
- Radera kontakt med en grupp med Python
Få SMS-leveransstatus med Python
import urllib2
afilnet_class="sms"
afilnet_method="getdeliverystatus"
afilnet_user="user"
afilnet_password="password"
afilnet_messages="123456,123457,123458"
afilnet_output=""
# Create an URL request
sUrl = "https://www.afilnet.com/api/http/?class="+afilnet_class+"&method="+afilnet_method+"&user="+afilnet_user+"&password="+afilnet_password+"&messages="+afilnet_messages+"&output="+afilnet_output
result = urllib2.urlopen(sUrl).read()
from urllib.request import urlopen
from urllib.parse import urlencode
afilnet_class="sms"
afilnet_method="getdeliverystatus"
afilnet_user="user"
afilnet_password="password"
afilnet_messages="123456,123457,123458"
afilnet_output=""
# Create an URL request
sUrl = "https://www.afilnet.com/api/http/"
data = urlencode({"class": afilnet_class,"method": afilnet_method,"user": afilnet_user,"password": afilnet_password,"messages": afilnet_messages,"output": afilnet_output}).encode("utf-8")
result = urlopen(sUrl, data).read()
print(result)
import requests
afilnet_class="sms"
afilnet_method="getdeliverystatus"
afilnet_user="user"
afilnet_password="password"
afilnet_messages="123456,123457,123458"
afilnet_output=""
# Create an URL request
sUrl = "https://www.afilnet.com/api/basic/?class="+afilnet_class+"&method="+afilnet_method+"&messages="+afilnet_messages+"&output="+afilnet_output
result = requests.get(sUrl,auth=requests.auth.HTTPBasicAuth(afilnet_user,afilnet_password))
print(result.text)
Parameter | Beskrivning | Obligatorisk / valfri |
---|---|---|
class=sms | Klass begärt: Klass som begäran görs till | Obligatorisk |
method=getdeliverystatus | Klassmetod begärd: Metod för den klass som begäran görs till | Obligatorisk |
user | Användare och e-post till ditt Afilnet-konto | Obligatorisk |
password | Lösenord för ditt Afilnet-konto | Obligatorisk |
messages | Lista över sändningsidentifierare separerade med komma (,) | Obligatorisk |
output | Outputformat för resultatet | Valfri |
När du gör förfrågningar får du följande fält:
- status
-
resultat (om status = framgång), här får du följande värden:
- messageid
- sms
- deliverydate
- deliverystatus
- fel (om status = fel), här får du felkoden
De möjliga felkoderna listas nedan
Koda | Beskrivning |
---|---|
MISSING_USER | Användare eller e-post ingår inte |
MISSING_PASSWORD | Lösenord ingår inte |
MISSING_CLASS | Klass ingår inte |
MISSING_METHOD | Metod ingår inte |
MISSING_COMPULSORY_PARAM | Obligatorisk parameter ingår inte |
INCORRECT_USER_PASSWORD | Felaktig användare eller lösenord |
INCORRECT_CLASS | Fel klass |
INCORRECT_METHOD | Fel metod |
parametrar:
- class : sms
- method : getdeliverystatus
- user : user
- password : password
- messages : 123456,123457,123458
- output :
Begäran:
https://www.afilnet.com/api/http/?class=sms&method=getdeliverystatus&user=user&password=password&messages=123456,123457,123458&output=