I am using SIM868e to communicate with Azure cosmos Db for my application. i am trying to use http GET for container from my Azure cosmos db. But i am not able to do it. I am using AT commands. Below are the AT command lines and responses:
AT
OK
AT+SAPBR=3,1,"Contype","GPRS"
OK
AT+SAPBR=3,1,APN,"internet"
OK
AT+SAPBR=1,1
OK
AT+SAPBR=2,1
+SAPBR: 1,1,"100.83.233.231"
AT+HTTPINIT
OK
AT+HTTPSSL=1
OK
AT+HTTPPARA=CID,"1"
OK
AT+HTTPPARA="URL","https://wm-testdb.documents.azure.com/dbs/WM/colls"
OK
AT+HTTPPARA="CONTENT","application/json"
OK
AT+HTTPPARA="USERDATA","Authorization:type=master&ver=1.0&sig={primary read only key}\r\nx-ms-version:2018-12-31\r\nx-ms-date:Thu, 30 Jun 2022 13:05:09 GMT"
OK
AT+HTTPACTION=0
OK
+HTTPACTION: 0,401,425
AT+HTTPREAD
+HTTPREAD: 425
{"code":"Unauthorized","message":"The input authorization token can't serve the request. The wrong key is being used or the expected payload is not built as per the protocol. For more info: https://ak
I am using primary key "Read only Keys" in authorization and real time for "x-ms-date:"
HARDWARE:
I am using SIM868e module which is connected with Hardware Serial2 of ESP32-wroom-32U and i am using arduino's serial monitor to send AT command lines to sim868e from ESP32.
Related
I'm trying to get a gprs connection to a server by using a sim 800 module.
I'm getting 601 errors.
I have tried the debbuging that are described in this question: error +HTTPACTION:0,601,0
AT
OK
ATZ
OK
AT+CFUN=1
OK
AT+CPIN?
+CPIN: READY
OK
AT+SAPBR=3,1,"Contype","GPRS"
OK
AT+SAPBR=3,1,"APN","internet.t-d1.de"
OK
AT+SAPBR=3,1,"USER","t-mobile"
OK
AT+SAPBR=3,1,"PWD","tm"
OK
AT+SAPBR=1,1
OK
AT+SAPBR=2,1
+SAPBR: 1,1,"37.83.19.125"
OK
AT+HTTPINIT
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPPARA="URL","https://mrgames-server.de/vehicle_safe/get.php?command=test"
OK
AT+HTTPACTION=0
OK
+HTTPACTION: 0,601,0
AT+HTTPREAD
OK
AT+HTTPTERM
Has anyone ever done this sucessfully?
I've learned that if you want to make a request to HTTPS websites, you need to use At+HTTPSSL=1. However, i'm trying to do the same, make a request to a https server and it's not working. I'm only getting 606/601/606 responses.
Also, remember, SIM800 only supports TSL1.0, as far as I know.
you should follow instructions that is written by SIMCOM itself.
https://cdn-shop.adafruit.com/datasheets/sim800_series_ip_application_note_v1.00.pdf
If you get network error 0,601,0, you can follow instructions under HTTP Get Post header. However, the only thing that you should do is putting AT+SAPBR=0,1 to end of the command sequence. Do your http configurations first, get http data from the url, and deact the process using AT+SAPBR=0,1. Moreover, in the application note you will notice that APN is configures as CMNET. You can try this, hopefully it is going to work.
I want to set the Real Time Clock on my STM32F4 board that I use with a SIM800 modem. I try to send HTTP GET or HEAD request (for example to "google.com") and use the timestamp in the response header to set my RTC.
I can send the request and get the response but I can't read the response's header.
The code is use and the response:
AT+HTTPINIT
OK
AT+HTTPPARA="CID",1
OK
AT+HTTPPARA="URL","www.google.com"
OK
AT+HTTPACTION=0
OK
+HTTPACTION: 0,302,256
AT+HTTPHEAD
ERROR
Why I got the ERROR at the end? I tried to send request to another URL, in this case I get HTTP OK(200) and can read data but still can't the header.
AT+HTTPHEAD doesn't work in sim800C. It works in: SIM800H,SIM800L,SIM800,SIM800G. Read "AT Command Manual" -
Only Part of Projects Support Following AT Commands.
+HTTPACTION: 0,302,256,
302 error is Found.
Check Mobile Balance or Internet Package in your sim.
It happens when you are out of Balance.
I'm trying to use the Telit GE910 cell module to make HTTP requests over the cell network. I've connected it via a FTDI board to my computer's USB port and am sending it AT commands via the terminal. I'm using the AT commands to successfully open a socket in command mode and send the HTTP request.
AT#SD=1,0,80,"google.com",0,0,1
OK
�AT#SSEND=1
> HE�AD� /� HTT�P/1.1
OK
SRING: 1
I don't understand why these � are turning up. When making requests for google.com this is fine but anything hosted on Heroku gives me a 505 error.
HTTP/1.1 505 HTTP Version Not Supported
Connection: close
Server: Cowboy
Date: Tue, 26 Apr 2016 20:39:34 GMT
Content-Length: 0
I've read in one or two forums that this 505 response is specific to Heroku and has to do with incorrect spacing in the HTTP request. I suspect the unrecognized characters are creating the problem. What is going on? They consistently turn up before 'A', 'space', and 'P'; there may be other letters also but those are the ones that I've seen.
Ok, I have figured out (I think) why I was getting a 505 response. Then I started getting a 400, but I figured that out too!
In the application note for socket dials from Nimbelink (which is a vendor that uses the Telit cell modules--I have one of their modules which has the Telit GE910 on it) it says that after you enter your HTTP request (e.g. GET / HTTP/1.1) you're meant to hit ctrl+j twice to signal the end of the request.
Well, I started doing all of my serial communication in CoolTerm so that I could see the HEX I was sending. (My hope was I could catch the � characters--I didn't, in fact they don't turn up in CoolTerm.) ctrl+j results in a single line feed (HEX: 0A). According to HTTP documentation, to signal the end of a line you're meant to use carriage return line feed (HEX: 0D 0A). (Heroku also says it has to be formatted like this.) This is what I send when I hit enter. So if I end GET / HTTP/1.1 with enter twice, the request gets though. Though even a HEAD / HTTP/1.1 request to heroku.com comes back as a 400. But that's up next:
According to RFC (which I found out here) HTTP 1.1 requires a Host. So if I do the whole thing with the right line endings
GET / HTTP/1.1
Host: heroku.com
it works! It also works for posting to my server.
AT+CSTT="live.vodafone.com"$0D$0A OK
AT+CIPSHUT$0D$0A SHUT OK
AT+CIPMUX=0$0D$0A OK
AT+CLPORT="TCP",80$0D$0A OK
AT+CIICR$0D$0A OK
AT+CIPSTART="TCP","http://ph.mydomain.in",80$0D$0A OK CONNECT OK
AT+CIPSEND$0D$0A
GET /phreading.aspx?value=092016040804550815 HTTP/1.1$0D$0A
Host: http://www.ph.mydomain.in$0D$0A$0D$0A
$1A
than i get following error.
Please help me to solve this problem. and tell me the right sequence to send data on server correctly.
Try to use AT+HTTPPARA command to send your get request. Its much easier than using the CIPSEND method.
Connect to GPRS
AT+CGATT?
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,1,"APN","live.vodafone.com"
AT+SAPBR=3,1,"USER","APN_USERNAME" // adapt it to yours
AT+SAPBR=3,1,"PWD","APN_PASSWORD" // adapt it to yours
AT+SAPBR=1,1
SEND DATA USING HTTP GET
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","www.ph.mydomain.in//phreading.aspx?value=092016040804550815"
AT+HTTPACTION=0 // sends HTTP GET
AT+HTTPTERM // terminate HTTP request
AT+SAPBR=0,1 // disconnect gprs if required
Hope this helps..
I'm stumped with sending data to a remote server , I'm able to send a post request but not sure how to add data which is then received by the server.
I've went through the datasheet http://www.jarzebski.pl/datasheets/SIM900_https-121018-1.00.pdf
tried
# usual at+sapbr=1,1 set up
+HTTPINIT
+HTTPPARA = “CID”,1
+HTTPPARA="URL","IP-ADDRESS:PORT"
+httpdata=100,10000
# Where do I add the post data ?
+httpaction=1
which sends the http post request. But how do I add data - I've tried adding it to the url ?key=val but no joy - any help here will be appreciated
httpdata=100,10000 means that SIM800 should expect 100 bytes within 10 seconds.
This is how I accomplished this using the HTTP client:
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://url.com/endPoint"
AT+HTTPPARA="CONTENT","application/json"
AT+HTTPDATA=40,10000
At this point, the SIM800 should respond with "DOWNLOAD". Which means it's expecting your data. Send in your data; in my case:
{"location_id": 238, "fill_percent": 90}
Wait 10 seconds to send the rest of the commands. Then:
AT+HTTPACTION=1
AT+HTTPREAD
AT+HTTPTERM
That did it for me. Hope it helps.
This is where I got the information from: http://www.raviyp.com/embedded/194-sim900-gprs-http-at-commands
In the backend, using Python Flask, this is the code I used
#app.route('/reportTrashLevel', methods=['POST'])
def report_trash_level():
data = request.get_json()
database.insert_trash_level(data)
return Response(status=200)
I managed to get it to do what I need, this code-snippet will likely help others
AT+CGATT=1 # enter GPRS configuration mode
AT+CIPMUX=0 # Disable multi IP connection mode. Single IP cnxn only
AT+CSTT="APN","USER","PASS"
AT+CIICR # bring up wireless connection with GPRS and CSD
AT+CIFSR # ip up - gprs working
AT+CIPSHUT # Exit GPRS configuration mode
# Now do a post request to remote server api in json format.
# Change IP_ADDR|DOMAIN for the IP or domain name of your server.
# Change 2000 to its port
AT+CIPSTART="TCP","IP_ADDR|DOMAIN","2000"
AT+CIPSEND=119 # Num of char in tcp/ip data, \r & \n count as 1 char
POST /post HTTP/1.1
Host: **.**.***.***
Content-Type: application/json
Content-Length:23
{"postkey":"postvalue"}
Hope this helps the next person stuck on it.