80630NT11837A Rev. 1 Page 36 of 40 2020-09-03
14. HTTP
The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed,
collaborative, hypermedia information systems. It is a generic, stateless protocol which
can be used for many tasks beyond its use for hypertext, such as name servers and
distributed object management systems, through extension of its request methods, error
codes and headers.
AT+EHTTPCREATE=0,41,41,""http://192.168.1.1:61613/",,,0,,0,,0," // create a HTTP client
+EHTTPCREAT:0 // 0: client id
OK
AT+EHTTPCON=0 // connect the server
OK
AT+EHTTPSEND=0,27,27,"0,0,9,"/Test.txt",0,,0,,0,," // get the file with path /Test.txt
OK
+EHTTPNMIH:0,404,157,Server: nginx/1.12.2 // report the header part of response
Date: Thu, 20 Dec 2018 09:14:27 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
+EHTTPNMIC:0,0,129,258,7b2274696d657374616d70223a22323031382d31322d32305430393a31343a323
72e3338302b30303030222c22737461747573223a3430342c226572726f72223a224e6f7420466f756e64222c
226d657373616765223a224e6f206d65737361676520617661696c61626c65222c2270617468223a222f54657
3742e747874227d
// reprot the content part of response
AT+EHTTPSEND=0,113,113,"0,1,9,"/postjson",0,,16,"application/json",66,7b2274657374223a313233343536
2c226d657373616765223a313333323432347d," //Send HTTP-post request
OK
+EHTTPNMIH:0,200,157,Server: nginx/1.12.2
Date: Thu, 20 Dec 2018 09:14:41 GMT
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
+EHTTPNMIC:0,0,33,66,7b2274657374223a3132333435362c226d657373616765223a313333323432347d
AT+EHTTPSEND=0,77,77,"0,2,4,"/put",0,,33,"application/x-www-formurlencoded",18,746573743d74657374," //Send HTTP-put request
OK
80630NT11837A Rev. 1 Page 37 of 40 2020-09-03