AT Commands For HTTPS
No | Command | Description |
F1301 | AT+HTTPINIT | Sart HTTP(S) service |
F1302 | AT+HTTPTERM | Stop HTTP(S) service. |
F1303 | AT+HTTPPARA | Set HTTP(S) Parameter |
F1304 | AT+HTTPACTION | HTTP(S) Method Action |
F1305 | AT+HTTPHEAD | Read the HTTP(S) Header Information of Server Response |
F1306 | AT+HTTPREAD | Read the response Information of HTTP(S) Server |
F1307 | AT+HTTPDATA | Input HTTP(S) Data |
F1308 | AT+HTTPPOSTFILE | Send HTTP(S) Request to HTTP server by File |
F1309 | AT+HTTPREADFILE | Receive HTTP(S) Response Content to a file |
F1301 AT+HTTPINIT Start HTTP(S) Service
AT+HTTPINIT is used to start HTTP service by activating PDP context.
You must execute AT+HTTPINIT before any other HTTP related operations
E) AT+HTTPINIT |
a)If start HTTP service successfully: OK b)If failed: ERROR |
Maximum Response Time | 120000ms |
<err> | 다음 페이지 참조 |
Example |
AT+HTTPINIT OK |
F1302 AT+HTTPTERM Stop HTTP(S) Service
AT+HTTPTERM is used to stop HTTP service
E) AT+HTTPTERM |
a)If stop HTTP service successfully: OK b)If failed: ERROR |
Maximum Response Time | 120000ms |
Example |
AT+HTTPTERM OK |
F1303 AT+HTTPPARA Set HTTP(S) Parameters Value
AT+HTTPPARA is used to set HTTP parameters value. When you want to access to a HTTP server,
you should input <value> like http://’server’/’path’:’tcpPort’. In addition, https://’server’/’path’:’tcpPort’ is used to access to a HTTPS server.
W) AT+HTTPPARA=”URL”,”<url> “ |
a) If parameter format is right: OK b) If parameter format is not right or other errors occur: ERROR |
W) AT+HTTPPARA=”CONNECTT O”,<conn_timeout> |
a) If parameter format is right: OK b) If parameter format is not right or other errors occur: ERROR |
W) AT+HTTPPARA=”RECVTO”,< recv_timeout> |
a) If parameter format is right: OK b) If parameter format is not right or other errors occur: ERROR |
W) AT+HTTPPARA=”CONTENT”, “<content_type>” |
a)If parameter format is right: OK b) If parameter format is not rightor other errors occur: ERROR |
W) AT+HTTPPARA=”ACCEPT”,” <accept-type>” |
a)If parameter format is right: OK b) If parameter format is not right or other errors occur: ERROR |
W) AT+HTTPPARA=”UA”,”<user _agent>” |
a)If parameter format is right: OK b) If parameter format is not right or other errors occur: ERROR |
W) AT+HTTPPARA=”SSLCFG”,” <sslcfg_id>” |
a)If parameter format is right: OK b) If parameter format is not right or other errors occur: ERROR |
W) AT+HTTPPARA=”USERDATA “,”<user_data>” |
a)If parameter format is right: OK b) If parameter format is not right or other errors occur: ERROR |
W) AT+HTTPPARA=”BREAK”,<b reak> |
a)If parameter format is right: OK b) If parameter format is not right or other errors occur: ERROR |
W) AT+HTTPPARA=”BREAKEND “,<breakend> |
a)If parameter format is right: OK b) If parameter format is not right or other errors occur: ERROR |
<url> |
URL of network resource, string start with “http://” or”https://” a)http://’server’/’path’:’tcpPort’. b)https://’server’/’path’:’tcpPort’ “server”: DNS domain name or IP address “path”: path to a file or directory of a server “tcpPort”: http default value is 80,https default value is 443.(can be omitted) |
<conn_timeout> | Timeout for accessing server, Numeric type, range is 20-120s, default is 120s. |
<recv_timeout> | Timeout for receiving data from server, Numeric type range is 2-120s, default is 10s. |
<content_type> | This is for HTTP “Content-Type” tag, String type, max length is 256, default is “text/plain”. |
<accept-type> | This is for HTTP “Accept-type” tag, String type, max length is 256,default is “*/*”. |
<user_agent> | Parameter for HTTP header User-Agent information.String type,max length is 256. |
<sslcfg_id> | This is setting SSL context id, Numeric type, range is 0-9. Default is 0. |
<user_data> | The customized HTTP header information. String type,max length is 512. |
<break> |
Parameter for HTTP method “GET”, used for resuming broken transfer. The start of the broken transfer. Default is 0. |
<breakend> |
Parameter for HTTP method “GET”, used for resuming broken transfer. The end of the broken transfer. Default is 0. If both “break” and “breakend” are 0, the resume broken transfer function is disabled. If “breakend” is bigger than “break”, the transfer scope is from “break” to “breakend”. If “breakend” is smaller than “break”, the transfer scope is from “break” to the end of the file. |
<resp_timeout> | Timeout for server response, Numeric type, range is 20-120s, default is 20s. |
Example |
AT+HTTPPARA=”USERDATA”,”Authorization: Basic Y2FycGx1c2dvOmNhcnBsdXgz” OK |
F1304 AT+HTTPACTION HTTP(S) Method Action
AT+HTTPACTION is used to perform a HTTP Method.
You can use HTTPACTION to send a get/post request to a HTTP/HTTPS server.
T) AT+HTTPACTION=? |
+HTTPACTION: (0-3) OK |
W) AT+HTTPACTION=<method> |
a)If parameter format is right : +HTTPACTION: <method>,<httpstatuscode>,<datalen> or OK +HTTPACTION: <method>,<errcode>,<datalen> b)If parameter format is not right or other errors occur: ERROR |
Maximum Response Time | 120000ms |
<method> |
HTTP method specification: 0 GET 1 POST 2 HEAD 3 DELETE |
<httpstatuscode> | Please refer to chapter 13.3.1 |
<errcode> |
Please refer to chapter 13.3.2 |
<datalen> | The length of data received |
Example |
AT+HTTPACTION=1 OK +HTTPACTION: 1,200,2800 |
F1305 AT+HTTPHEAD Read The HTTP(S) Header Information Of Server Response
AT+HTTPHEAD is used to read the HTTP header information of server response when module receives the response data from server
E) AT+HTTPHEAD |
a)If read the header information successfully: +HTTPHEAD: DATA,<data_len> <data> OK b)If read failed: ERROR |
<data_len> | The length of HTTP header |
<data> | The header information of HTTP response |
Example |
AT+CHTTPHEAD +HTTPHEAD: 750 HTTP/1.1 200 OK
Date: Thu, 29 Mar 2018 09:21:12 GMT Content-Type: text/html Content-Length: 14615 Last-Modified: Thu, 15 Mar 2018 08:23:00 GMT Connection: Keep-Alive Vary: Accept-Encoding Set-Cookie: BAIDUID=EF38663A5539EBEAE702321037D5491B:FG=1; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com Set-Cookie: BIDUPSID=EF38663A5539EBEAE702321037D5491B; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com Set-Cookie: PSTM=1522315272; expires=Thu, 31-Dec-37 23:55:55 GMT; max-age=2147483647; path=/; domain=.baidu.com P3P: CP=” OTI DSP COR IVA OUR IND COM “ Server: BWS/1.1 X-UA-Compatible: IE=Edge,chrome=1 Pragma: no-cache Cache-control: no-cache Accept-Ranges: bytes OK |
F1306 AT+HTTPREAD Read The Response Information Of HTTP(S) Server
After sending HTTP(S) GET/POST requests, you can retrieve HTTP(S) response information from HTTP(S) server via UART/USB port by AT+HTTPREAD.
When the of “+HTTPACTION:<method>,<statuscode>,<datalen>” is not equal to 0, you can read the response information from HTTP(S) server by AT+HTTPREAD.
You can execute AT+HTTPREAD? to check the total data saved in buffer, then AT+HTTPREAD= <byte_size> to read out data to port.
If parameter is set greater than the size of data saved in buffer, all data in buffer will output to port.
R) AT+HTTPREAD? |
a)If check successfully: +HTTPREAD: LEN,<len> OK b)If failed(no more data other error): ERROR |
W) AT+HTTPREAD=<byte_size> |
a)If read the response info successfully: OK +HTTPREAD: DATA,<data_len> <data> [+HTTPREAD: DATA,<data_len> <data>…] +HTTPREAD: 0 If <byte_size> is bigger than the data size received, module will only return actual data size. b) If read failed: ERROR |
Maximum Response Time | 120000ms |
<byte_size> | The length of data to read |
<data_len> | The actual length of read data |
<data> | Response content from HTTP server |
<len> | Total size of data saved in buffer |
Example |
AT+HTTPREAD=0,10 OK +HTTPREAD: 10 <!doctyped +HTTPREAD: 0 |
F1307 AT+HTTPDATA Input HTTP(S) Data
You can use AT+HTTPDATA to input data to post when you send a HTTP/HTTPS POST request.
W) AT+HTTPDATA=<size>,<time> |
a)if parameter format is right: DOWNLOAD <input data here> When the total size of the inputted data reaches <size>, TA will report the following code. Otherwise, the serial port will be blocked. OK b)If parameter format is wrong or other errors occur: ERROR |
<size> | Size in bytes of the data to post. range is 1- 153600 (bytes) |
<time> | Maximum time in seconds to input data, range is 10-65535. |
Example |
AT+HTTPDATA=14,10000 DOWNLOAD 1234567890qwer OK |
F1308 AT+HTTPPOSTFILE Send HTTP Request To HTTP(S) Server By File
You also can send HTTP request in a file via AT+HTTPPOSTFILE command.
The URL must be set by AT+HTTPPARA before executing AT+HTTPPOSTFILE command.
if set <send_header> to 0, you can customize any HTTP request in the file, module will send the file as HTTP header and body,
else if set to 1, modem will package a HTTP request itself, the file will be sent as HTTP body.
The parameter <path> can be used to set the file directory.
When modem has received response from HTTP server,
it will report the following URC: +HTTPPOSTFILE:<method>[,<httpstatuscode>[,<content_length>]]
Note: The parameter <method>, <send_header>, <path> can be omitted,
and the default value of <send_header> is 0, the default <path> is 1 (/cache), default <method> is 1 (POST)
T) AT+HTTPPOSTFILE=? |
+HTTPPOSTFILE: <filename>[,(1-3)[,(0-3)[,(0-1)]]] OK |
W) AT+HTTPPOSTFILE=<filenam e>[,<path>][,<method>][,<sen d_header>] |
a) if parameter format is right and server connected successfully: a.1 server response and content is not null OK +HTTPPOSTFILE: <method>,<httpstatuscode>,<content_len> a.2 server response but has no content OK +HTTPPOSTFILE: <method>,<httpstatuscode>,0 b) if parameter format is right but server connected unsuccessfully: OK +HTTPPOSTFILE: <method>,<errcode>,0 c) if parameter format is not right or any other error occurs: ERROR |
Maximum Response Time | 120000ms |
<filename> | String type, filename, the max length is 64.unit:byte. |
<path> |
The directory where the sent file saved. Numeric type, range is 1-3 1 F:/ (/cache) 2 D:/(sd card) 3 E:/ (/data/media/) |
<method> |
HTTP method specification: 0 GET 1 POST 2 HEAD 3 DELETE |
<httpstatuscode> | Please refer to chapter 13.3.1 |
<content_length> | Server response content |
<errcode> | Please refer to chapter13.3.2 |
<send_header> |
Send file as HTTP header and Body or Only as Body. Numeric type, the range is 0-1, the default is 0. 0 Send file as HTTP header and body 1 Send file as Body |
Example |
AT+HTTPPOSTFILE=”baidu.txt”,3 OK +HTTPPOSTFILE: 1,714,0 |
F1309 AT+HTTPREADFILE Receive HTTP(S) response content to a file
After executing AT+HTTPACTION or AT+HTTPOSTFILE command, you can receive the HTTP server response content to a file via AT+HTTPREADFILE.
Before AT+HTTPREADFILE executed,
”+HTTPACTION:<mehtod>,<httpstautscode>,<content_len>” or ”+HTTPPOSTFILE: <httpstatuscode>,<content_len>” must be received.
The parameter <path> can be used to set the directory where to save the file. If omit the parameter, the file will be saved to /cache.
NOTE:
By setting <path> to 4, you can download CA files to directory /mssl_cert/, which is used for SSL verification,
T) AT+HTTPREADFILE=? |
+HTTPREADTFILE: <filename>[,(1-4)] OK |
W) AT+HTTPREADFILE=<filena me>[,<path>] |
a)if parameter format is right : OK +HTTPREADFILE: <result> b) if parameter format is right: +HTTPREADFILE: <result> OK c) if failed: +HTTPREADFILE: <result> ERROR d) if parameter format is not right or any other error occurs: ERROR |
<filename> | String type, filename, the max length is 64 in byte. |
<path> |
1 F:/ (/cache/) 2 D:/ (sd card) 3 E:/ (/data/media/) 4 /mssl_cert/ (this is for CA file downloading) |
Example |
AT+HTTPREADFILE=”baidu.txt”,3 OK +HTTPREADFILE: 0 |