Quectel AG35 HTTP (S) AT Commands Manual V1.0 PDF
Quectel AG35 HTTP (S) AT Commands Manual V1.0 PDF
Quectel AG35 HTTP (S) AT Commands Manual V1.0 PDF
AT Commands Manual
Rev. AG35_HTTP(S)_AT_Commands_Manual_V1.0
Date: 2017-10-13
www.quectel.com
LTE Module Series
AG35 HTTP(S) AT Commands Manual
Our aim is to provide customers with timely and comprehensive service. For any
assistance, please contact our company headquarters:
l
http://quectel.com/support/sales.htm
e
For technical support, or to report documentation errors, please visit:
t
http://quectel.com/support/technical.htm
c l
Or email to: [email protected]
u e t ia
GENERAL NOTES
n
QUECTEL OFFERS THE INFORMATION AS A SERVICE TO ITS CUSTOMERS. THE INFORMATION
PROVIDED IS BASED UPON CUSTOMERS’ REQUIREMENTS. QUECTEL MAKES EVERY EFFORT
Q ide
TO ENSURE THE QUALITY OF THE INFORMATION IT MAKES AVAILABLE. QUECTEL DOES NOT
MAKE ANY WARRANTY AS TO THE INFORMATION CONTAINED HEREIN, AND DOES NOT ACCEPT
ANY LIABILITY FOR ANY INJURY, LOSS OR DAMAGE OF ANY KIND INCURRED BY USE OF OR
f
RELIANCE UPON THE INFORMATION. ALL INFORMATION SUPPLIED HEREIN IS SUBJECT TO
CHANGE WITHOUT PRIOR NOTICE.
COPYRIGHT
o n
THE INFORMATION CONTAINED HERE IS PROPRIETARY TECHNICAL INFORMATION OF
C
QUECTEL WIRELESS SOLUTIONS CO., LTD. TRANSMITTING, REPRODUCTION, DISSEMINATION
AND EDITING OF THIS DOCUMENT AS WELL AS UTILIZATION OF THE CONTENT ARE
FORBIDDEN WITHOUT PERMISSION. OFFENDERS WILL BE HELD LIABLE FOR PAYMENT OF
DAMAGES. ALL RIGHTS ARE RESERVED IN THE EVENT OF A PATENT GRANT OR
REGISTRATION OF A UTILITY MODEL OR DESIGN.
Copyright © Quectel Wireless Solutions Co., Ltd. 2017. All rights reserved.
History
Revision Date
t el Author Description
l
Chris PENG/
c
1.0 2017-10-13 Initial
Mandy WANG
u e t ia
Q ide n
n f
Co
Contents
1 Introduction .......................................................................................................................................... 6
1.1. The Process of Using HTTP(S) AT Commands ...................................................................... 6
1.2. Description of HTTP(S) Header .............................................................................................. 7
1.2.1. Customize HTTP(S) Request Header ............................................................................. 7
l
1.2.2. Output HTTP(S) Response Header ................................................................................. 7
1.3. Description of Data Mode ........................................................................................................ 7
t e
2 Description of HTTP(S) AT Commands ............................................................................................. 9
l
2.1. AT+QHTTPCFG Configure Parameters for HTTP(S) Server ............................................... 9
c
2.2. AT+QHTTPURL Set URL of HTTP(S) Server .................................................................... 12
a
2.3. AT+QHTTPGET Send GET Request to HTTP(S) Server .................................................. 13
e i
2.4. AT+QHTTPGETEX Send Range GET Request to HTTP(S) Server.................................. 14
u t
2.5. AT+QHTTPPOST Send POST Request to HTTP(S) Server via UART/USB .................... 15
n
2.6. AT+QHTTPPOSTFILE Send POST Request to HTTP(S) Server via File ......................... 17
2.7. AT+QHTTPREAD Read Response from HTTP(S) Server via UART/USB ........................ 18
Q ide
2.8. AT+QHTTPREADFILE Read Response from HTTP(S) Server via File ............................ 19
2.9. AT+QHTTPSTOP Cancel HTTP(S) Request ..................................................................... 20
f
3 Examples ............................................................................................................................................ 21
3.1. Access to HTTP Server ......................................................................................................... 21
n
3.1.1. Send HTTP GET Request and Read the Response ..................................................... 21
3.1.2. Send HTTP POST Request and Read the Response ................................................... 22
o
3.1.2.1. Post Body Obtained from UART/USB .................................................................. 22
3.1.2.2. Post Body Obtained from File System ................................................................. 23
C
3.2. Access to HTTPS Server ...................................................................................................... 24
3.2.1. Send HTTPS GET Request and Read the Response ................................................... 24
3.2.2. Send HTTPS POST Request and Read the Response ................................................ 26
3.2.2.1. Post Body Obtained from UART/USB .................................................................. 26
3.2.2.2. Post Body Obtained from File System ................................................................. 28
7 Appendix A References..................................................................................................................... 36
t el
e c ia l
u n t
Q ide
n f
Co
Table Index
t el
e c ia l
u n t
Q ide
n f
Co
1 Introduction
AG35 provides HTTP(S) application to HTTP(S) server. This document is a reference guide to all the AT
commands defined for HTTP(S).
l
1.1. The Process of Using HTTP(S) AT Commands
t e l
Through AG35 TCP/IP AT commands, customers can configure a PDP context, activate/deactivate the
c
PDP context and query the PDP context status. And through AG35 HTTP(S) AT commands, customers
e ia
can send HTTP(S) GET/POST requests to HTTP(S) server, and read HTTP(S) response from HTTP(S)
t
server. The general process is as follows:
u n
Step 1: Configure <APN>, <username>, <password> and other parameters of a PDP context by
Q ide
AT+QICSGP. Please refer to Quectel_AG35_TCP(IP)_AT_Commands_Manual for details. If
QoS settings need to be updated, configure them by AT+CGQMIN, AT+CGEQMIN,
AT+CGQREQ and AT+CGEQREQ commands. For more details, please refer to
Quectel_AG35_AT_Commands_Manual.
f
Step 2: Activate the PDP context by AT+QIACT, then the assigned IP address can be queried by
n
AT+QIACT?. Please refer to Quectel_AG35_TCP(IP)_AT_Commands_Manual for details.
o
Step 3: Configure the PDP context ID and SSL context ID by AT+QHTTPCFG command.
Step 4: Configure SSL context parameters by AT+QSSLCFG command. For more details, please refer
C
to Quectel_AG35_SSL_AT_Commands_Manual.
Step 6: Send HTTP(S) request. AT+QHTTPGET command can be used for sending HTTP(S) GET
request, and AT+QHTTPPOST or QHTTPOSTFILE command can be used for sending HTTP(S)
POST request.
Step 8: Deactivate the PDP context by AT+QIDEACT command. For more details, please refer to
Quectel_AG35_TCP(IP)_AT_Commands_Manual.
HTTP(S) request header is filled by the module automatically. HTTP(S) request header can be
customized by configuring <request_header> as 1 via AT+QHTTPCFG command, and then inputting
HTTP(S) request header according to the following requirements:
l
configured by AT+QHTTPURL command.
3. The HTTP(S) request header must end with <CR><LF>.
t e
The following example shows a valid HTTP(S) POST request header:
c a l
POST /processorder.php HTTP/1.1<CR><LF>
e i
Host: 220.180.239.212:8011<CR><LF>
t
Accept: */*<CR><LF>
u
User-Agent: QUECTEL_MODULE<CR><LF>
n
Connection: Keep-Alive<CR><LF>
Q ide
Content-Type: application/x-www-form-urlencoded<CR><LF>
Content-Length: 48<CR><LF>
<CR><LF>
f
Message=1111&Appleqty=2222&Orangeqty=3333&find=1
n
1.2.2. Output HTTP(S) Response Header
o
HTTP(S) response header will not be outputted automatically. HTTP(S) response header information can
C
be obtained by configuring <response header> to 1 via AT+QHTTPCFG command, and then HTTP(S)
response header will be outputted with HTTP(S) response body after executing AT+QHTTPREAD or
AT+QHTTPREADFILE command.
The COM port of AG35 module has two working modes: AT command mode and data mode. In AT
command mode, the inputted data via COM port will be treated as AT command. While in data mode, it
will be treated as data.
Inputting “+++” or pulling up DTR (AT&D1 should be set first) can make the COM port exit from data mode.
To prevent the “+++” from being misinterpreted as data, the following sequence should be followed:
When AT+QHTTPURL, AT+QHTTPOST and AT+QHTTPREAD are executed, the COM port will enter
data mode. If customers are using “+++” or DTR to make the port exit from data mode, the executing
procedure of these commands will be interrupted before the response is returned. In such case, the COM
port cannot reenter data mode by executing ATO command.
t el
e c ia l
u n t
Q ide
n f
Co
l
The command is used to configure the parameters for HTTP(S) server, including configuring a PDP
e
context ID, customizing HTTP(S) request header, outputting HTTP(S) response header and querying SSL
t
settings. If the Write Command only executes one parameter, it will query the current settings.
c l
AT+QHTTPCFG Configure Parameters for HTTP(S) Server
e ia
Test Command Response
t
AT+QHTTPCFG=? +QHTTPCFG: “contextid”,(1-16)
u
+QHTTPCFG: “requestheader”,(0,1)
n
+QHTTPCFG: “responseheader”,(0,1)
Q ide
+QHTTPCFG: “sslctxid”,(0-5)
+QHTTPCFG: "contenttype",(0-3)
+QHTTPCFG: "rspout/auto",(0,1)
+QHTTPCFG: "closed/ind",(0,1)
n f
OK
Write Command Response
o
AT+QHTTPCFG=“contextid”[,<context If <contextID> is not omitted:
ID>] OK
C
Or
+CME ERROR: <err>
OK
Write Command Response
AT+QHTTPCFG=“requestheader”[,<re If <request_header> is not omitted:
quest_header>] OK
Or
+CME ERROR: <err>
+QHTTPCFG: “requestheader”,<request_header>
OK
Write Command Response
AT+QHTTPCFG=“responseheader”[,<r If <response_header> is not omitted:
esponse_header>] OK
Or
+CME ERROR: <err>
l
OK
t e
Write Command Response
l
AT+QHTTPCFG=“sslctxid”[,<sslctxID> If <sslctxID> is not omitted:
c
] OK
a
Or
e i
+CME ERROR: <err>
u n t
If <sslctxID> is omitted, query the current settings:
+QHTTPCFG: “sslctxid”,<sslctxID>
Q ide
OK
Write Command Response
f
AT+QHTTPCFG=“rspout/auto”[,<auto_ If <auto_outrsp> is not omitted:
outrsp>] OK
n
Or
o
+CME ERROR: <err>
C
If <auto_outrsp> is omitted, query the current settings:
+QHTTPCFG: “rspout/auto”,<auto_outrsp>
OK
Write Command Response
AT+QHTTPCFG=“closed/ind”[,<closed If <closedind> is not omitted:
ind>] OK
Or
+CME ERROR: <err>
OK
OK
l
Parameter
t e
<contextID> Numeric type. PDP context ID. The range is 1-16, and the default value is 1.
c l
<request_header> Numeric type. Disable or enable to customize HTTP(S) request header.
0 Disable
e ia
1 Enable
t
<response_header> Numeric type. Disable or enable to output HTTP(S) response header.
u
0 Disable
n
1 Enable
Q ide
<sslctxID> Numeric type. SSL context ID used for HTTP(S). The range is 0-5, and the
default value is 1. Customers should configure the SSL parameters by
AT+QSSLCFG. For details, please refer to Quectel_AG35_SSL_AT_
Commands_Manual.
f
<content_type> Numeric type. Data type of HTTP(S) body.
n
0 application/x-www-form-urlencoded
1 text/plain
o
2 application/octet-stream
3 multipart/form-data
C
<auto_outrsp> Numeric type. Disable or enable auto output of HTTP(S) response data. If
auto output of HTTP(S) response data is enabled, then the execution of
AT+QHTTPREAD and AT+QHTTPREADFILE commands will be failed.
0 Disable
1 Enable
<closedind> Numeric type. Disable or enable report indication of closed HTTP(S) session.
0 Disable
1 Enable
<err> Integer type. The error code of the operation. Please refer to Chapter 5.
URL must begin with “http://” or “https://”, which indicates you will access to an HTTP or HTTPS server.
OK
Write Command Response
l
AT+QHTTPURL=<URL_length>[,<tim a) If the parameter format is correct, and it is not sending
eout>] HTTP(S) GET/POST requests:
t e
CONNECT
c l
TA switches to transparent access mode, and the URL can be
a
inputted. When the total size of the inputted data reaches
e i
<URL_length>, TA will return to command mode and report
u t
the following code:
n
OK
Q ide
If the <timeout> has reached, but the received length of URL
is less than <URL_length>, TA will return to command mode
and report the following code:
f
+CME ERROR: <err>
n
b) If the parameter format is incorrect or other errors occur:
o
+CME ERROR: <err>
Read Command Response
C
AT+QHTTPURL? [+QHTTPURL: <URL><CR><LF>]
OK
Parameter
<URL_length> Numeric type. The length of URL. The range is 1-700. Unit: byte.
<timeout> Numeric type. The maximum time for inputting URL. The range is 1-65535, and
the default value is 60. Unit: second.
<err> Integer type. The error code of the operation. Please refer to Chapter 5.
After AT+HTTPGET Write Command has been sent, it is recommended to wait for a specific period of
time (refer to the maximum response time below) for “+QHTTPGET:
l
<err>[,<httprspcode>[,<content_length>]]” to be outputted after “OK” is reported.
e
In “+QHTTPGET: <err>[,<httprspcode>[,<content_length>]]”, the <httprspcode> parameter can only be
t
reported when <err> equals 0. If HTTP(S) response header contains “CONTENT-LENGTH” information,
c l
then <content_length> information will be reported.
e ia
AT+QHTTPGET Send GET Request to HTTP(S) Server
u t
Test Command Response
n
AT+QHTTPGET=? +QHTTPGET: (1-65535),(1-2048),(1-65535)
Q ide
OK
If <request_header> equals 0 (disable Response
to customize HTTP(S) request header) a) If the parameter format is correct and no other errors occur:
f
Write Command OK
AT+QHTTPGET[=<rsptime>]
n
When the module has received response from HTTP(S)
o
server, it will report the following URC:
+QHTTPGET: <err>[,<httprspcode>[,<content_length>]]
C
b) If the parameter format is incorrect or other errors occur:
+CME ERROR: <err>
If <request_header> equals 1 (enable to Response
customize HTTP(S) request header) a) If HTTP(S) server is connected successfully:
Write Command CONNECT
AT+QHTTPGET=<rsptime>,<data_len
gth>[,<input_time>] TA switches to transparent access mode, and the HTTP(S)
GET request header can be inputted. When the total size of
the inputted data reaches <data_length>, TA will return to
command mode and report the following code:
OK
+QHTTPGET: <err>[,<httprspcode>[,<content_length>]]
l
Parameter
t e l
<rsptime> Numeric type. The range is 1-65535, and the default value is 60. Unit: second. It is
c
used to configure the timeout for the HTTP(S) GET response “+QHTTPGET:
a
<err>[,<httprspcode>,<content_length>]” to be outputted after “OK” is returned.
e i
<data_length> Numeric type. The length of HTTP(S) request information, including HTTP(S)
u t
request header and HTTP(S) request body. The range is 1-2048. Unit: byte.
n
<input_time> Numeric type. The maximum time for inputting HTTP(S) request
information. The range is 1-65535, and the default value is 60. Unit: second.
Q ide
<err> Integer type. The error code of the operation. Please refer to Chapter 5.
<httprspcode> Please refer to Chapter 6.
<request_header> Please refer to Chapter 2.1.
f
<content_length> Numeric type. The length of HTTP(S) response body. Unit: byte.
o
2.4. AT+QHTTPGETEX
C
Like read files, MCU can get data from HTTP(S) server with specified position and specified length by
AT+HTTPGETEX command, and this command is only executable in the condition of
AT+QHTTPCFG=”requestheader”,0. After that, HTTP(S) server will always respond to Range GET
Request with “206” code.
OK
Write Command Response
AT+QHTTPGET=<rsptime>,<start_po a) If the parameter format is correct and no other errors occur:
sition>,<read_len> OK
Parameter
l
<rsptime> Numeric type. The range is 1-65535, and the default value is 60. Unit: second. It is
used to configure the timeout for the HTTP(S) GET response “+QHTTPGET:
e
<err>[,<httprspcode>,<content_length>]” to be outputted after “OK” is returned.
t l
<start_postion > Numeric type. The start position of the data that the HTTP(S) client wants to GET.
c
<read_length> Numeric type. The length of the data that the HTTP(S) client wants to GET.
a
<err> Integer type. The error code of the operation. Please refer to Chapter 5.
e i
<httprspcode> Please refer to Chapter 6.
u t
<content_length> Numeric type. The length of HTTP(S) response body. Unit: byte.
Q ide
2.5. AT+QHTTPPOST
f
UART/USB
n
The command is used to send HTTP(S) POST request. According to the configured <request_header>
o
parameter in AT+QHTTPCFG=“requestheader”[,<request_header>] command, the AT+HTTPPOST Write
Command has two different formats. If <request_header> is set to 0, post body should be inputted via
C
UART/USB port. If <request_header> is set to 1, then both post header and body should be inputted via
UART/USB port.
After AT+QHTTPPOST command has been sent, “CONNECT” may be outputted in 125s to indicate the
connection is successful. If it is not received during the time, “+CME ERROR: <err>” will be outputted.
It is recommended to wait for a specific period of time (refer to the maximum response time below) for
“+QHTTPPOST: <err>[,<httprspcode>[,<content_length>]]” to be outputted after “OK” is reported.
OK
If <request_header> equals 0 (disable Response
to customize HTTP(S) request header) a) If the parameter format is correct and HTTP(S) server is
Write Command connected successfully and HTTP(S) request header is sent
AT+QHTTPPOST=<data_length>[,<in completely, it will prompt you to input body:
put_time>,<rsptime>] CONNECT
l
When the module has received response from HTTP(S)
server, it will report the following URC:
e
+QHTTPPOST: <err>[,<httprspcode>[,<content_length>]]
c t l
If the <input_time> has reached, but the received length of
a
data is less than <data_length>, TA will return to command
e i
mode and report the following code:
u t
+CME ERROR: <err>
n
b) If the parameter format is incorrect or other errors occur:
Q ide
+CME ERROR: <err>
If <request_header> equals 1 (enable to Response
customize HTTP(S) request header) a) If the parameter format is correct and HTTP(S) server is
f
Write Command connected successfully:
AT+QHTTPPOST=<data_length>[,<in CONNECT
n
put_time>,<rsptime>]
o
TA switches to the transparent access mode, and the
HTTP(S) POST header and body can be inputted. When the
C
total size of the inputted data reaches <data_length>, TA will
return to command mode and report the following code:
OK
Parameter
l
<rsptime> Numeric type. The range is 1-65535, and the default value is 60. Unit:
e
second. It is used to configure the timeout for the HTTP(S) POST response
t
“+QHTTPPOST: <err>[,<httprspcode>[,<content_length>]]” to be outputted
l
after “OK” is returned.
c
<err> Integer type. The error code of the operation. Please refer to Chapter 5.
e a
<httprspcode> Please refer to Chapter 6.
t i
<request_header> Please refer to Chapter 2.1.
u
<content_length> Numeric type. The length of HTTP(S) response body. Unit: byte.
Q ide
2.6. AT+QHTTPPOSTFILE
f
File
n
The command can be used to send HTTP(S) POST request via file. According to the <request_header>
o
in AT+QHTTPCFG=“requestheader”[,<request_header>] command, the file operated by
AT+HTTPPOSTFILE command has two different formats. If <request_header> is set to 0, the file in file
C
system will be post body. If <request_header> is set to 1, the file in file system will be post header and
body.
It is recommended to wait for a specific period of time (refer to the maximum response time below) for
“+QHTTPPOSTFILE: <err>[,<httprspcode>[,<content_length>]]” to be outputted after “OK” is reported.
OK
l
b) If parameter format is incorrect or other errors occur:
e
+CME ERROR: <err>
t l
Maximum Response Time Determined by <rsptime>
Parameter
e c t ia
u n
<file_name> String type. File name, the max length of file name is 80. Unit: byte.
Q ide
<rsptime> Numeric type. The range is 1-65535, and the default value is 60. Unit:
second. It is used to configure the timeout for the HTTP(S) POST response
“+QHTTPPOSTFILE: <err>[,<httprspcode>,<content_length>]” to be
outputted after “OK” is returned.
f
<err> Integer type. The error code of the operation. Please refer to Chapter 5.
<httprspcode> Please refer to Chapter 6.
n
<request_header> Please refer to Chapter 2.1.
o
<content_length> Numeric type. The length of HTTP(S) response body. Unit: byte.
C
2.7. AT+QHTTPREAD Read Response from HTTP(S) Server via
UART/USB
After sending HTTP(S) GET/POST requests, customers can retrieve HTTP(S) response information from
HTTP(S) server via UART/USB port by AT+QHTTPREAD command. And “+QHTTPGET:
<err>[,<httprspcode>[,<content_length>]]”, “+QHTTPPOST: <err>[,<httprspcode>[,<content_length>]]” or
“+QHTTPPOSTFILE: <err>[,<httprspcode>,<content_length>]” information must be received before
executing AT+QHTTPREAD command.
OK
Write Command Response
AT+QHTTPREAD[=<wait_time>] a) If the parameter format is correct and read successfully:
CONNECT
<Output HTTP(S) response information>
OK
+QHTTPREAD: <err>
l
been outputted completely, it will report the following code:
+CME ERROR: <err>
t e l
b) If the parameter format is incorrect or other errors occur:
c
+CME ERROR: <err>
e t ia
Parameter
u n
<wait_time> Numeric type. The maximum interval time between receiving two packets of data.
Q ide
The range is 1-65535, and the default value is 60. Unit: second.
<err> Integer type. The error code of the operation. Please refer to Chapter 5.
n f
2.8. AT+QHTTPREADFILE Read Response from HTTP(S) Server via File
o
After sending HTTP(S) GET/POST requests, customers can retrieve HTTP(S) response information from
HTTP(S) server via file by AT+QHTTPREADFILE. And “+QHTTPGET:
C
<err>[,<httprspcode>[,<content_length>]]”, “+QHTTPPOST: <err>[,<httprspcode>[,<content_length>]]” or
“+QHTTPPOSTFILE: <err>[,<httprspcode>,<content_length>]” information must be received before
executing AT+QHTTPREADFILE command.
OK
Write Command Response
AT+QHTTPREADFILE=<file_name>[, a) If the parameter format is correct:
<wait_time>] OK
+QHTTPREADFILE: <err>
Parameter
<wait_time> Numeric type. The maximum interval time between receiving two packets of
data. The range is 1-65535, and the default value is 60. Unit: second.
<file_name> String type. File name. The maximum length of the file name is 80 bytes.
l
<err> Integer type. The error code of the operation. Please refer to Chapter 4.
t e l
2.9. AT+QHTTPSTOP Cancel HTTP(S) Request
e c ia
MCU can cancel HTTP(S) GET/POST request, and disconnect session with HTTP(S) server via this
u t
command.
n
AT+QHTTPSTOP Cancel HTTP(S) Request
Q ide
Test Command Response
AT+QHTTPSTOP=? OK
Execution Command Response
f
AT+QHTTPSTOP a) If the parameter format is correct and no other errors occur:
OK
o n
b) If the parameter format is incorrect or other errors occur:
+CME ERROR: <err>
C
Maximum Response Time 10s
3 Examples
l
3.1.1. Send HTTP GET Request and Read the Response
t e
The following examples show how to send HTTP GET request and enable output of HTTP response
l
header, as well as how to read HTTP GET response.
c a
//Example of how to send HTTP GET response.
e t i
AT+QHTTPCFG=“contextid”,1 //Configure the PDP context ID as 1.
u
OK
n
AT+QHTTPCFG=“responseheader”,1 //Allow to output HTTP response header.
Q ide
OK
AT+QIACT? //Query the state of context.
OK
AT+QICSGP=1,1,“UNINET”,“”,“”,1 //Configure PDP context 1. APN is “UNINET” for China Unicom.
f
OK
n
AT+QIACT=1 //Activate context 1.
OK //Activated successfully.
o
AT+QIACT? //Query the state of context.
+QIACT: 1,1,1,"10.7.157.1"
C
OK
AT+QHTTPURL=23,80 //Set the URL which will be accessed.
CONNECT
HTTP://www.sina.com.cn/ //Input URL whose length is 23 bytes. (This URL is only an
example. Please input the correct URL in practical test.)
OK
AT+QHTTPGET=80 //Send HTTP GET request and the maximum response time is
80s.
OK
//Solution 1: Read HTTP response information and output it via UART port.
l
Content-Length: 601710<CR><LF>
e
Connection: close<CR><LF>
t
Last-Modified: Tue, 12 Sep 2017 05:54:48 GMT<CR><LF>
l
Vary: Accept-Encoding<CR><LF>
c
Expires: Tue, 12 Sep 2017 05:58:28 GMT<CR><LF>
e ia
Cache-Control: max-age=60<CR><LF>
t
X-Powered-By: shci_v1.03<CR><LF>
u
Age: 1<CR><LF>
n
……<CR><LF> //Lines are omitted here
Q ide
<CR><LF>
<body>
OK
f
+QHTTPREAD: 0 //Read HTTP response header and body successfully.
n
//Solution 2: Read HTTP response information and store it to RAM file.
o
AT+QHTTPREADFILE=“RAM:1.txt”,80 //Read HTTP response header and body and store them to
“RAM:1.txt”. The maximum time to wait for HTTP session to
C
be closed is 80s.
OK
The following examples show how to send HTTP POST request and retrieve post body via UART port, as
well as how to read HTTP POST response.
OK
AT+QHTTPURL=59,80 //Set the URL which will be accessed.
l
CONNECT
http://api.efxnow.com/DEMOWebServices2.8/Service.asmx/Echo? //Input URL whose length is 59
e
bytes. (This URL is only an
t
example. Please input the
c l
correct URL in practical test.)
a
OK
e i
AT+QHTTPPOST=20,80,80 //Send HTTP POST request. POST body is obtained via UART.
u t
The maximum input body time is 80s and the maximum
n
response time is 80s.
CONNECT
Q ide
Message=HelloQuectel //Input post body whose length is 20 bytes. (The post body is
only an example. Please input the correct post body in
practical test.)
f
OK
n
+QHTTPPOST: 0,200,177 //If the HTTP response header contains
“CONTENT-LENGTH” information, then the <content_length>
o
information will be reported.
AT+QHTTPREAD=80 //Read HTTP response body and output it via UART. The
C
maximum time to wait for HTTP session to be closed is 80s.
CONNECT
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="httpHTTPs://api.efxnow.com/webservices2.3">Message='HelloQuectel' ASCII:72
101 108 108 111 81 117 101 99 116 101 108 </string> //Output HTTP response body.
OK
The following examples show how to send HTTP POST request and retrieve post body via file system, as
well as how to store HTTP POST response to file system.
l
OK
AT+QHTTPURL=59,80 //Set the URL which will be accessed.
e
CONNECT
t
http://api.efxnow.com/DEMOWebServices2.8/Service.asmx/Echo? //Input URL whose length is 59
c l
bytes. (This URL is only an
a
example. Please input the
e i
correct URL in practical test.)
u t
OK
n
//POST request information from RAM file, and read HTTP response information and store it to RAM file.
Q ide
AT+QHTTPPOSTFILE=“RAM:2.txt”,80 //Send HTTP POST request. POST body is obtained from
“RAM:2.txt”, and the maximum response time is 80s.
OK
f
+QHTTPPOSTFILE: 0,200,177 //After HTTP POST request is sent successfully, you can
n
execute AT+QHTTPREAD command.
//Read HTTP response body and store it to “RAM:3.txt”. The
o
AT+QHTTPREADFILE=“RAM:3.txt”,80
maximum time to wait for HTTP session to be closed is 80s.
OK
C
+QHTTPREADFILE: 0 //HTTP response body is stored successfully.
The following examples show how to send HTTPS GET request and enable output of HTTPS response
header, as well as how to read HTTPS GET response.
OK
AT+QHTTPCFG=“responseheader”,1 //Allow to output HTTPS response header.
OK
AT+QIACT? //Query the state of context.
OK
AT+QICSGP=1,1,“UNINET”,“”,“”,1 //Configure PDP context 1. APN is “UNINET” for China Unicom.
OK
AT+QIACT=1 //Activate context 1.
OK //Activated successfully.
AT+QIACT? //Query the state of context.
+QIACT: 1,1,1,"10.7.157.1"
l
OK
e
AT+QHTTPCFG=“sslctxid”,1 //Set SSL context ID.
t
OK
c l
AT+QSSLCFG=“sslversion”,1,1 //Set SSL version as 1 which means TLSV1.0.
a
OK
e i
AT+QSSLCFG=“ciphersuite”,1,0x0005 //Set SSL cipher suite as 0x0005 which means RC4-SHA.
u t
OK
n
AT+QSSLCFG=“seclevel”,1,0 //Set SSL verify level as 0 which means you do not need any
CA certificate.
Q ide
OK
AT+QHTTPURL=22,80 //Set the URL which will be accessed.
CONNECT
f
https://www.alipay.com //Input URL whose length is 19 bytes. (This URL is only an
example. Please input the correct URL in practical test.)
n
OK
o
AT+QHTTPGET=80 //Send HTTPS GET request and the maximum response time is
80s.
OK
C
+QHTTPGET: 0,200,21472 //If the HTTPS response header contains “CONTENT-LENGTH”
information, then the <content_length> information will be
reported.
l
//Solution 2: Read HTTPS response information and store it to RAM file.
e
AT+QHTTPREADFILE=“RAM:4.txt”,80 //Read HTTPS response header and body and store them to
t
“RAM:4.txt”. The maximum time to wait for HTTPS session to
l
be closed is 80s.
c
OK
e t ia
+QHTTPREADFILE: 0 //HTTPS response header and body are stored successfully.
u
Q ide n
3.2.2. Send HTTPS POST Request and Read the Response
f
The following examples show how to send HTTPS POST request and retrieve post body via UART port,
n
as well as how to read HTTPS POST response.
o
AT+QHTTPCFG=“contextid”,1 //Configure the PDP context ID as 1.
OK
C
AT+QIACT? //Query the state of context.
OK
AT+QICSGP=1,1,“UNINET”,“”,“”,1 //Configure PDP context 1. APN is “UNINET” for China Unicom.
OK
AT+QIACT=1 //Activate context 1.
OK //Activated successfully.
AT+QIACT? //Query the state of context.
+QIACT: 1,1,1,"172.22.86.226"
OK
AT+QHTTPCFG=“sslctxid”,1 //Set SSL context ID.
OK
AT+QSSLCFG=“sslversion”,1,1 //Set SSL version as 1 which means TLsV1.0.
OK
AT+QSSLCFG=“ciphersuite”,1,0x0005 //Set SSL cipher suite as 0x0005 which means RC4-SHA.
OK
AT+QSSLCFG=“seclevel”,1,2 //Set SSL verify level as 2 which means you should upload CA
certificate, client certificate and client private key by
AT+QFUPL command.
OK
AT+QSSLCFG=“cacert”,1, “RAM:cacert.pem”
OK
AT+QSSLCFG=“clientcert”,1,“RAM:clientcert.pem”
OK
AT+QSSLCFG=“clientkey”,1,“RAM:clientkey.pem”
OK
l
AT+QHTTPURL=45,80 //Set the URL which will be accessed.
CONNECT
e
HTTPs://220.180.239.212:8011/processorder.php //Input URL whose length is 45 bytes. (This URL is
t
only an example. Please input the correct URL in
c l
practical test.)
a
OK
e i
AT+QHTTPPOST=48,80,80 //Send HTTPS POST request. POST body is obtained from UART.
u t
The maximum input body time is 80s and the maximum
n
response time is 80s.
CONNECT
Q ide
Message=1111&Appleqty=2222&Orangeqty=3333&find=1 //Input post body whose length is 48 bytes.
(This post body is only an example.
Please input the correct one in practical
f
test.)
OK
n
//If the HTTPS response header contains “CONTENT-LENGTH”
o
+QHTTPPOST: 0,200,285
information, then the <content_length> information will be
reported.
C
AT+QHTTPREAD=80 //Read HTTPS response body and output it via UART. The
maximum time to wait for HTTPS session to be closed is 80s.
CONNECT //Read HTTPS response body successfully.
<html>
<head>
<title>Quectel's Auto Parts - Order Results</title>
</head>
<body>
<h1>Quectel's Auto Parts</h1>
<h2>Order Results</h2>
OK
The following examples show how to send HTTPS POST request and retrieve post body from file system,
as well as how to store HTTPS POST response to file system.
l
AT+QHTTPCFG=“contextid”,1 //Configure the PDP context ID as 1.
e
OK
t
AT+QIACT? //Query the state of context.
c l
OK
AT+QICSGP=1,1,“UNINET”,“”,“”,1 //Configure PDP context 1. APN is “UNINET” for China Unicom.
e ia
OK
t
AT+QIACT=1 //Activate context 1.
u
OK //Activated successfully.
n
AT+QIACT? //Query the state of context.
Q ide
+QIACT: 1,1,1,"172.22.86.226"
OK
AT+QHTTPCFG=“sslctxid”,1 //Set SSL context ID.
f
OK
n
AT+QSSLCFG=“sslversion”,1,1 //Set SSL version as 1 which means TLsV1.0.
OK
o
AT+QSSLCFG=“ciphersuite”,1,0x0005 //Set SSL cipher suite as 0x0005 which means RC4-SHA.
OK
C
AT+QSSLCFG=“seclevel”,1,2 //Set SSL verify level as 2 which means you should upload CA
certificate, client certificate and client private key by
AT+QFUPL command.
OK
AT+QSSLCFG=“cacert”,1,“RAM:cacert.pem”
OK
AT+QSSLCFG=“clientcert”,1,“RAM:clientcert.pem”
OK
AT+QSSLCFG=“clientkey”,1,“RAM:clientkey.pem”
OK
AT+QHTTPURL=45,80 //Set the URL which will be accessed.
CONNECT
https:// 220.180.239.212:8011/processorder.php //Input URL whose length is 45 bytes. (This URL is
only an example. Please input the correct URL in
practical test.)
OK
//POST request information from RAM file, and read HTTPS response information and store it to RAM file.
+QHTTPPOSTFILE: 0,200,177 //After HTTPS POST request is sent successfully, you can
execute AT+QHTTPREAD command.
AT+QHTTPREADFILE=“RAM:6.txt”,80 //Read HTTPS response body and store it to “RAM:6.txt”. The
maximum time to wait for HTTPS session to be closed is
l
80s.
OK
t e
+QHTTPREADFILE: 0 //HTTPS response body is stored successfully.
e c ia l
u n t
Q ide
n f
Co
4 Error Handling
l
When executing HTTP(S) AT commands, if “ERROR” response is received from the module, please
e
check whether the (U)SIM card is inserted and whether it is “+CPIN: READY” returned when executing
t
AT+CPIN?.
e c ia l
t
4.2. PDP Activation Fails
u n
If it is failed to active a PDP context by AT+QIACT command, please check the following configurations:
Q ide
1. Query whether the PS domain is attached or not by AT+CGATT? command. If not, please execute
AT+CGATT=1 command to attach the PS domain.
f
2. Query the PS domain status by AT+CGREG? command and make sure the PS domain has been
registered.
n
3. Query the PDP context parameters by AT+QICSGP command and make sure the APN of specified
PDP context has been set.
o
4. Make sure the specified PDP context ID is neither used by PPP nor activated by AT+CGACT
command.
C
5 According to 3GPP specifications, the module only supports three PDP contexts activated
simultaneously, so customers must make sure the number of activated PDP contexts is less than 3.
If all above configurations are correct, but activating the PDP context by AT+QIACT command still fails,
please reboot the module to resolve this issue. After rebooting the module, please check the
configurations mentioned above for at least three times and each time at an interval of 10 minutes to
avoid frequently rebooting the module.
t e
4.4. Entering Data Mode Fails
l
e c a l
When executing AT+QHTTPURL, AT+QHTTPGET, AT+QHTTPPOST and AT+QHTTPREAD commands,
i
if “+CME ERROR: 704” (704: HTTP(S) UART busy) is returned, please check whether there are other
u t
ports in data mode, since the module only supports one port in data mode at a time. If any, please
n
re-execute these commands after other ports have exited from data mode.
Q ide
4.5. Sending GET/POST Requests Fails
n f
When executing AT+QHTTPGET, AT+QHTTPPOST and QHTTPPOSTFILE commands, if a failed result
is received, please check the following configurations:
o
1. Make sure the URL inputted via AT+HTTPURL command is valid and can be accessed.
C
2. Make sure the specified server supports GET/POST commands.
3. Make sure the PDP context has been activated successfully.
If all above configurations are correct, but sending GET/POST requests by AT+QHTTPGET,
AT+QHTTPPOST and AT+QHTTPPOSTFILE commands still fails, please deactivate the PDP context by
AT+QIDEACT and re-activate the PDP context by AT+QIACT to resolve this issue. If activating the PDP
context fails, please refer to Chapter 4.2 to resolve it.
“+QHTTPGET: <err>[,<httprspcode>[,<content_length>]]”/
“+QHTTPPOST: <err>[,<httprspcode>[,<content_length>]]”/
“+QHTTPPOSTFILE: <err>[,<httprspcode>,<content_length>]”
t el
e c ia l
u n t
Q ide
n f
Co
l
Table 1: Summary of Error Codes
e
<err> Meaning
c t l
0 Operation successful
e ia
701 HTTP(S) unknown error
u t
702 HTTP(S) timeout
n
703 HTTP(S) busy
Q ide
704 HTTP(S) UART busy
f
706 HTTP(S) network busy
n
707 HTTP(S) network open failed
o
708 HTTP(S) network no configuration
C
709 HTTP(S) network deactivated
l
725 Voice call busy
t e
726 Input timeout
c l
727 Wait data timeout
e ia
728 Wait HTTP(S) response timeout
u t
729 Memory allocation failed
Q ide n
730 Invalid parameter
n f
Co
l
Table 2: Summary of HTTP(S) Response Codes
t e
<httprspcode> Meaning
c l
200 OK
e ia
403 Forbidden
u t
404 Not found
Q ide n
409 Conflict
f
500 Internal server error
o n
C
AG35_HTTP(S)_AT_Commands_Manual Confidential / Released 35 / 36
LTE Module Series
AG35 HTTP(S) AT Commands Manual
7 Appendix A References
l
[1] RFC2616 Hyper Text Transport Protocol
t e
Introduction about AG35 TCP/IP AT
[2] Quectel_AG35_TCP(IP)_AT_Commands_Manual
l
commands
c a
[3] Quectel_AG35_FILE_Application_Note AG35 FILE application note
e t i
[4] Quectel_AG35_AT_Commands_Manual AG35 AT commands manual
u n
Introduction about AG35 SSL AT
[5] Quectel_AG35_SSL_AT_Commands_Manual
commands
Q ide
Table 4: Terms and Abbreviations
f
Abbreviation Description
n
DNS Domain Name Server
o
DTR Data Terminal Ready
C
HTTP Hyper Text Transport Protocol