I'm absolute new in PureBasic and struggle to get a working http post request.
This is the requirement I got for the http post:
URL: https://enlighten.enphaseenergy.com/log ... =xxxxxxxxx
Header:
"Accept": "application/json",
"content-type": "application/x-www-form-urlencoded",
"Cache-Control": "no-cache"
Json Body:
"user[email]": username,
"user[password]": password
I I tried a few things but nothing worked, like this:
Code: Select all
NewMap Header$()
Header$("Accept") = "application/json"
Header$("content-type") = "application/x-www-form-urlencoded"
Header$("Cache-Control") = "no-cache"
NewMap Body$()
Body$("user[email]") = "my_name@gmail.com"
Body$("user[password]") = "xxxxxxxxxx"
result = HTTPRequest(#PB_HTTP_Post, "https://enlighten.enphaseenergy.com/login/login.json?serialnumber=1234567890", Body$(), 0, Header$())
Debug "StatusCode: " + HTTPInfo(result, #PB_HTTP_StatusCode)
Debug "Response: " + HTTPInfo(result, #PB_HTTP_Response)
Has anybody some ideas?
Kind regards
Roman




