SIM7000 Series - HTTP (S) - Application Note - V1.03
SIM7000 Series - HTTP (S) - Application Note - V1.03
HTTP(S)_Application Note
LPWA Module
GENERAL NOTES
COPYRIGHT
www.simcom.com 2 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
About Document
Version History
Scope
www.simcom.com 3 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
Contents
About Document.................................................................................................................................. 3
Version History.........................................................................................................................................................3
Scope........................................................................................................................................................................ 3
Contents................................................................................................................................................. 4
1 Introduction.................................................................................................................................... 5
1.1 Purpose of the document...........................................................................................................................5
1.2 Related documents.....................................................................................................................................5
1.3 Conventions and abbreviations................................................................................................................ 5
2 HTTP(S) Function..........................................................................................................................6
2.1 Characteristic............................................................................................................................................... 6
2.2 Request Method.......................................................................................................................................... 6
5 HTTP(S) Examples......................................................................................................................13
5.1 HTTP Function.......................................................................................................................................... 13
5.1.1 HTTP GET..................................................................................................................................... 13
5.1.2 HTTP POST...................................................................................................................................14
5.2 HTTPS Function........................................................................................................................................17
5.1.1 HTTPS download and convert SSL certificate........................................................................ 17
5.2.1 HTTPS GET...................................................................................................................................18
5.2.2 HTTPS POST................................................................................................................................ 19
www.simcom.com 4 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
1 Introduction
Based on module AT command manual, this document will introduce HTTP(S) application process.
Developers could understand and develop application quickly and efficiently based on this document.
In application, controlling device controls the GSM engine by sending AT Command via its serial interface.
The controlling device at the other end of the serial line is referred to as following term:
TE (Terminal Equipment);
DTE (Data Terminal Equipment) or plainly "the application" which is running on an embedded system;
www.simcom.com 5 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
2 HTTP(S) Function
HTTP (HyperText Transfer Protocol) is an application layer protocol. When you browse a web page, the
browser and the web server will send and receive data on the Internet through the HTTP protocol. HTTP is
a stateless protocol based on request and response patterns. That is what we usually call
Request/Response.
2.1 Characteristic
According to the HTTP standard, HTTP requests can use a variety of request methods.
HTTP 1.0 defines three request methods: the GET, POST, and HEAD methods.
HTTP1.1 adds six new request methods: OPTIONS, PUT, PATCH, DELETE, TRACE, and CONNECT
methods.
www.simcom.com 6 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
No Method Description
1 GET Make a request to a specific resource.
Ask the server for a response that is consistent with the GET request, except that
the response body will not be returned. This method can obtain the meta
2 HEAD
information contained in the response message header without having to transmit
the entire response content.
Submit data to a specified resource for processing requests (such as submitting a
form or uploading a file). The data is included in the request body. POST requests
3 POST
may result in the creation of new resources and/or modifications to existing
resources.
4 PUT Uploads its latest content to a specified resource location.
5 DELETE Requests the server to delete the resource identified by the Request-URI.
H The HTTP/1.1 protocol is reserved for proxy servers that can connect
6 CONNECT
connections to pipes.
Returns the HTTP request method supported by the server for a particular
7 OPTIONS resource. You can also test the functionality of the server by sending a '*' request
to the web server.
8 TRACE Echoes requests received by the server, primarily for testing or diagnostics.
9 PATCH It is a supplement to the PUT method for local updating of known resources.
The SIM7000 series supports several methods: GET, POST, PUT, PATCH and HEAD.
www.simcom.com 7 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
AT Command Description
AT+SHSSL Select SSL Configure
AT+SHCONF Set HTTP(S) Parameter
AT+SHCONN HTTP(S) Connection
AT+SHBOD Set Body
AT+SHBODEXT Set Extension Body
AT+SHAHEAD Add Head
AT+SHPARA Set HTTP(S) Para
AT+SHCPARA Clear HTTP(S) Para
AT+SHCHEAD Clear Head
AT+SHSTATE Query HTTP(S) Connection Status
AT+SHREQ Set Request Type
AT+SHREAD Read Response Value
AT+SHDISC Disconnect HTTP(S)
AT+HTTPTOFS Download file to ap file system
AT+HTTPTOFSRL State of download file to ap file system
www.simcom.com 8 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
www.simcom.com 9 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
4 Bearer Configuration
OK
AT+CGDCONT=1,"IP","" //Configure APN for registration when needed
OK
AT+CSQ //Check RF signal
+CSQ: 27,99
OK
AT+CGATT? //Check PS service.
+CGATT: 1 //1 indicates PS has attached.
OK
AT+COPS? //Query Network information, operator and network
+COPS: 0,0,"CHN-CT",9 mode 9, NB-IOT network
OK
AT+CGNAPN //Query the APN delivered by the network after the
CAT-M or NB-IOT network is successfully
registered.
+CGNAPN: 1,"ctnb" //"ctnb" is APN delivered by the CAT-M or NB-IOT
network. APN is empty under the GSM network.
OK
AT+CNCFG=1,"ctnb","cdma","1234" //Before activation please use AT+CNCFG to set
APN\user name\password if needed.
OK
AT+CNACT=1 //Activate network
OK
www.simcom.com 10 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
OK
AT+CFUN=0 //Disable RF
+CPIN: NOT READY
OK
AT+CGDCONT=1,"IP","ctnb" //Set the APN manually
OK
AT+CFUN=1 //Enable RF
OK
+CPIN: READY
AT+CGATT? //Check PS service.
+CGATT: 1 //1 indicates PS has attached.
OK
AT+CGNAPN //Query the APN delivered by the network after the
CAT-M or NB-IOT network is successfully
registered.
+CGNAPN: 1,"ctnb"
//"ctnb" is APN delivered by the CAT-M or NB-IOT
www.simcom.com 11 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
OK
www.simcom.com 12 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
5 HTTP(S) Examples
+SHREQ: "GET",200,387
AT+SHREAD=0,387 //Read data length is 387
OK //The data content is follow “+SHREAD: 387”
www.simcom.com 13 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
+SHREAD: 387
{
"args": {
"password": "123",
"user": "jack"
},
"headers": {
"Accept": "*/*",
"Cache-Control": "no-cache",
"Content-Length": "0",
"Host": "httpbin.org",
"User-Agent": "curl/7.47.0",
"X-Amzn-Trace-Id":
"Root=1-5ed706c8-99b97372ae6f043f805cf243"
},
"origin": "117.132.195.245",
"url":
"http://httpbin.org/get?user=jack&password=12
3"
}
OK
AT+SHCHEAD //Clear HTTP header
OK
AT+SHAHEAD="Content-Type","application/x- //Add header content
www.simcom.com 14 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
www-form-urlencoded"
OK
AT+SHAHEAD="Cache-control","no-cache" //Add header content
OK
AT+SHAHEAD="Connection","keep-alive" //Add header content
OK
AT+SHAHEAD="Accept","*/*" //Add header content
OK
AT+SHCPARA //Clear body content parameter
OK
AT+SHPARA="product","apple" //Add body content parameter
OK
AT+SHPARA="price","1" //Add body content parameter
OK
AT+SHREQ="/post",3 //Set request type is POST
OK //Get data size is 452.
+SHREQ: "POST",200,452
AT+SHREAD=0,452 //Read data length is 452
OK //The data content is follow “+SHREAD: 452”
+SHREAD: 452
{
"args": {},
"data": "",
"files": {},
"form": {
"price": "1",
"product": "apple"
},
"headers": {
"Accept": "*/*",
"Cache-Control": "no-cache",
"Content-Length": "21",
"Content-Type":
"application/x-www-form-urlencoded",
"Host": "httpbin.org",
"X-Amzn-Trace-Id":
"Root=1-5ed633df-058feb6412204392e95333b2
"
},
"json": null,
"origin": "218.204.252.187",
"url": "http://httpbin.org/post"
}
www.simcom.com 15 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
OK
AT+SHCHEAD //Clear HTTP header
OK
AT+SHAHEAD="Content-Type","application/x- //Add header content
www-form-urlencoded"
OK
AT+SHAHEAD="Cache-control","no-cache" //Add header content
OK
AT+SHAHEAD="Connection","keep-alive" //Add header content
OK
AT+SHAHEAD="Accept","*/*" //Add header content
OK
AT+SHBOD=" {\"title\":\"Hello http server\"}",29 //Set body content
OK
AT+SHREQ="/post",3 //Set request type is POST
OK //Get data size is 457.
+SHREQ: "POST",200,457
AT+SHREAD=0,457 //Read data length is 457
OK //The data content is follow “+SHREAD: 457”
+SHREAD: 457
{
"args": {},
"data": "{\"title\":\"Hello http server\"}",
"files": {},
www.simcom.com 16 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
"form": {},
"headers": {
"Accept": "*/*",
"Cache-Control": "no-cache",
"Content-Length": "29",
"Content-Type": "application/json",
"Host": "httpbin.org",
"X-Amzn-Trace-Id":
"Root=1-5ed63fa7-3dda07707b3f2ea63e092a3a"
},
"json": {
"title": "Hello http server"
},
"origin": "218.204.252.187",
"url": "http://httpbin.org/post"
}
AT+CFSINIT
//Init FS AT command
OK
AT+CFSWFILE=3,"httpbin_root_ca.cer",0,1492 //After download, sent certificate file through the
,1000 serial port.1492 is certificate size.
DOWNLOAD
//Send CA file success
OK
AT+CFSTERM
//Free data buffer
OK
AT+CSSLCFG="convert",2,"httpbin_root_ca.c //Conversion CA certificate format.
er" //2 means CA type.
OK //httpbin_root_ca.cer is CA certificate name.
www.simcom.com 17 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
OK
AT+SHCHEAD //Clear HTTP header content
OK
AT+SHAHEAD="User-Agent","curl/7.47.0" //Add header content
OK
AT+SHAHEAD="Cache-control","no-cache" //Add header content
OK
AT+SHAHEAD="Connection","keep-alive" //Add header content
OK
AT+SHAHEAD="Accept","*/*" //Add header content
OK
AT+SHREQ="/get?user=jack&password=123",1 //Set request type is GET.
OK //Get data size is 388
+SHREQ: "GET",200,388
AT+SHREAD=0,388 //Read data length is 388
OK //The data content is follow “+SHREAD: 388”
+SHREAD: 388
{
"args": {
"password": "123",
"user": "jack"
},
www.simcom.com 18 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
"headers": {
"Accept": "*/*",
"Cache-Control": "no-cache",
"Content-Length": "0",
"Host": "httpbin.org",
"User-Agent": "curl/7.47.0",
"X-Amzn-Trace-Id":
"Root=1-5ed706c8-99b97372ae6f043f805cf243"
},
"origin": "117.132.195.245",
"url":
"https://httpbin.org/get?user=jack&password=1
23"
}
OK
AT+SHCHEAD //Clear HTTP header
OK
AT+SHAHEAD="Content-Type","application/x- //Add header content
www-form-urlencoded"
OK
www.simcom.com 19 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
+SHREQ: "POST",200,453
AT+SHREAD=0,453 //Read data length is 453
OK //The data content is follow “+SHREAD: 453”
+SHREAD: 453
{
"args": {},
"data": "",
"files": {},
"form": {
"price": "1",
"product": "apple"
},
"headers": {
"Accept": "*/*",
"Cache-Control": "no-cache",
"Content-Length": "21",
"Content-Type":
"application/x-www-form-urlencoded",
"Host": "httpbin.org",
"X-Amzn-Trace-Id":
"Root=1-5ed633df-058feb6412204392e95333b2
"
},
"json": null,
"origin": "218.204.252.187",
"url": "https://httpbin.org/post"
}
www.simcom.com 20 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
OK
AT+SHCHEAD //Clear HTTP header
OK
AT+SHAHEAD="Content-Type","application/js //Add header content
on"
OK
AT+SHAHEAD="Cache-control","no-cache" //Add header content
OK
AT+SHAHEAD="Connection","keep-alive" //Add header content
OK
AT+SHAHEAD="Accept","*/*" //Add header content
OK
AT+SHBOD=" {\"title\":\"Hello http server\"}",29 //Set body content
OK
AT+SHREQ="/post",3 //Set request type is POST
OK //Get data size is 458.
+SHREQ: "POST",200,458
AT+SHREAD=0,458 //Read data length is 458
OK //The data content is follow “+SHREAD: 458”
+SHREAD: 458
{
"args": {},
"data": "{\"title\":\"Hello http server\"}",
www.simcom.com 21 / 22
SIM7000 Series_HTTP(S)_Application Note_V1.03
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Cache-Control": "no-cache",
"Content-Length": "29",
"Content-Type": "application/json",
"Host": "httpbin.org",
"X-Amzn-Trace-Id":
"Root=1-5ed63fa7-3dda07707b3f2ea63e092a3a
"
},
"json": {
"title": "Hello http server"
},
"origin": "218.204.252.187",
"url": "https://httpbin.org/post"
}
www.simcom.com 22 / 22