HTTP AT command set

This chapter introduces the driver HTTP instruction set. This instruction set will be adapted differently for different modules. For specific differences, please move to:Firmware iterations and differences.

AT+HTTPCLIENTLIN:Send HTTP client request

Execute command

Command:

AT+HTTPCLIENTLINE=<transport_type>,<opt>,<content-type>,<host>,<port>,<path>[,<data>]

Response:

Response length:<len> //response body Data length
<response> //Response data obtained
OK

Parameters

  • <transport_type>:request protocol
    • 1:HTTP

    • 2:HTTPS

  • <opt>:request type.
    • 2:GET

    • 3:POST

  • <content-type>:Request data type. (Only valid for POST, not valid for GET, you can fill in any string, the reference type is as follows)
    • application/x-www-form-urlencoded

    • application/json

    • multipart/form-data

    • text/xml

    • text/html

  • <host>:Server domain name or IP.
    • eg:www.baidu.com or 192.168.1.100。

  • <port>:The port number.
    • HTTP default value 80,HTTPS default value 443.

  • <path>: HTTP(S)path.
    • default value”/”

  • <data>: Data carried by the request.
    • 1:When opt is GET, this is carried in the patch, and the format meets the http format requirements(?key1=value1&key2=value2 …)

    • 2:When opt is POST, this is the body carried by POST.

Description

  • Make an HTTP request.

Example

//GET request
AT+HTTTPCLIENTLINE=1,2,"application/x-www-form-urlencoded","httpbin.org",80,"/get?key1=123&key2=456"

//POST request
AT+HTTTPCLIENTLINE=1,3,"application/json","httpbin.org",80,"/post",{"key1": 123}

AT+HTTPRAW:Send an HTTP client POST (with long text) request

executive command

command:

AT+HTTPRAW=<transport_type>,<opt>,<content-type>,<host>,<port>,<path>,len

response:

::

> //After receiving this character, enter the data to be sent

OK //After receiving this character, start to enter the data to be sent. When the corresponding byte data is received, the data will be sent (can be any number). When the corresponding byte data is received, the data will be sent (can be any data)

parameter

  • <transport_type>:Request protocol.
    • 1:HTTP

    • 2:HTTPS

  • <opt>:request type.
    • 3:POST

  • <content-type>:Request data type. (Only POST takes effect, GET does not take effect, you can fill in any string, the reference type is as follows).
    • application/x-www-form-urlencoded

    • application/json

    • multipart/form-data

    • text/xml

    • text/html

  • <host>:Domain name or IP address of the server.
    • eg:www.baidu.com or 192.168.1.100.

  • <port>:port number.
    • HTTP default value 80,HTTPS default value 443.

  • <path>: HTTP(S)path.
    • default value”/”.

  • <len>: Request to carry data.
    • Request data length.

explain

  • Initiates an HTTP request.

example

AT+HTTPRAW=1,3,"application/json","httpbin.org",80,"/post",13

>{"key1": 123}