Hello, I’m trying to use eWon’s Talk2M DMWeb API to access to data stored in the cloud. Basically, I’m just testing the ‘getewons’ method, which requires two params, the developer id and Talk2m token, inside the body request (set as x-www-form-urlencoded).
Using Postman I get this result
which is good, because actualy I have not eWon registered on the Talk2M account.
Using Python, with the
requests
library I get the same result.
Using Ignition 8.1 rc-3, I tried to use system.net.httpClient, here’s the code:
url = "https://data.talk2m.com/getewons"
devId = "6de9e..."
t2mtoken = "pkv8..."
data={"t2mdevid":devId,"t2mtoken":t2mtoken}
headers = {'Content-Type': "application/x-www-form-urlencoded"}
http = system.net.httpClient()
http.post(url=url, data=data, headers=headers).json
And I got this output
{'code': 400L, 'message': u"Missing argument 't2mdevid' for method parameter of type String", 'success': False}
which is the same result I get if I don’t pass the ‘data’ parameter.
I also tried with the system.net.httpPost method, in it’s two forms:
system.net.httpPost(url=url, postParams=data)
system.net.httpPost(url=url, postData=str(data), headerValues=headers)
In both cases I’m getting this error:
IOError: Server returned HTTP response code: 400 for URL: https://data.talk2m.com/getewons
What am I doing wrong?