Hello,
I am trying to use the API post methods to send an SMS to my device using a python script.
I am using the below script that I have made up. Python version is 3.7
import json
from urllib.request import Request, urlopen
HOLOGRAM_API_KEY = "MYAPIKEY"
url = "https://dashboard.hologram.io/api/1/sms/incoming?apikey="+HOLOGRAM_API_KEY
print (url)
values ={
"deviceid": "xxxxx",
"fromnumber": "+356xxxxxxxx",
"body": "Hello world!"
}
hd = {"Content-Type": "application/json"}
req = Request(url, json.dumps(values).encode('ascii'), hd)
with urlopen(req) as response:
json_response = json.load(response)
print(json_response)
This is the error that I am getting:
urllib.error.HTTPError: HTTP Error 400: Bad Request
Can someone guide me to what I am doing wrong please?
Thanks