- Support portal
- Evaluation Kits and partner products
u-blox Support
- Product documentation
Documentation
- About
- Sustainability
- Partners and Alliances
- Contact
About u-blox
- Investor relations
Investor relations
The section describes the u-blox proprietary AT commands that can be used for sending requests to a remote HTTP server, receiving the server response and transparently storing it in the file system. The supported methods are: HEAD, GET, DELETE, PUT, POST file and POST data. The HTTP client requires an active connection to work. Some products require additional commands to provide connectivity to the application.
LEXI-R10401D-00B / LEXI-R10801D-00B
If not specified, the default CID (<cid>=1) is used. If not specified and the protocol type is IPv4v6, then the preferred protocol type is IPv4.
First connection attempt will be performed using selected preferred type and in case of failure it will try with other protocol type. Error returned in case of connection failure will be related to latest protocol type used.
See +CGACT AT command for activating a PDP context.
The only profile allowed is number 0 for HTTP operations.
When these commands report an HTTP error, the error code of latest failure can be queried using the +UHTTPER AT command.
The HTTP client can support multiple HTTP profiles, the <profile_id> is a number starting from 0:
There is only one profile: 0
+UHTTP | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
partial | No | No | No | - |
Configures, reads or resets (to the factory-programmed values) the HTTP application profile parameters. Up to 4 different HTTP profiles can be defined. To set all the parameters in an HTTP profile a set command for each <op_code> needs to be issued.
The configured HTTP profile parameters are not saved in the non volatile memory.
The read command has two possible usages. The functionality of the command differs with the number of command parameters issued:
Only the first command parameter (<profile_id>) issued: the module resets all the profile parameters (to the factory-programmed values) for the profile specified with <profile_id>
Only the first and second command parameters used (<profile_id>, <op_code>): the module returns the current value of the profile parameter specified with <op_code> and related to the profile specified with <profile_id>
Type | Syntax | Response | Example |
---|---|---|---|
Generic syntax | |||
Set | AT+UHTTP=<profile_id>,<op_code>,<param_val>[,<param_val1>] | OK | AT+UHTTP=2,0,"125.24.51.133" OK |
Read | AT+UHTTP=<profile_id>,<op_code> | +UHTTP: <profile_id>,<op_code>,<param_val>[,<param_val1>] OK | AT+UHTTP=2,0 +UHTTP: 2,0,"125.24.51.133" OK |
HTTP server IP address | |||
Set | AT+UHTTP=<profile_id>,0,<HTTP_server_IP_address> | OK | AT+UHTTP=2,0,"125.24.51.133" OK |
Read | AT+UHTTP=<profile_id>,0 | +UHTTP: <profile_id>,0,<HTTP_server_IP_address> OK | AT+UHTTP=2,0 +UHTTP: 2,0,"125.24.51.133" OK |
HTTP server name | |||
Set | AT+UHTTP=<profile_id>,1,<HTTP_server_name> | OK | AT+UHTTP=2,1,"www.u-blox.com" OK |
Read | AT+UHTTP=<profile_id>,1 | +UHTTP: <profile_id>,1,<HTTP_server_name> OK | AT+UHTTP=2,1 +UHTTP: 2,1,"www.u-blox.com" OK |
Username | |||
Set | AT+UHTTP=<profile_id>,2,<username> | OK | AT+UHTTP=2,2,"my_user" OK |
Read | AT+UHTTP=<profile_id>,2 | +UHTTP: <profile_id>,2,<username> OK | AT+UHTTP=2,2 +UHTTP: 2,2,"my_user" OK |
Password | |||
Set | AT+UHTTP=<profile_id>,3,<password> | OK | AT+UHTTP=2,3,"pwd" OK |
Read | AT+UHTTP=<profile_id>,3 | +UHTTP: <profile_id>,3,<password> OK | AT+UHTTP=2,3 +UHTTP: 2,3,"pwd" OK |
Authentication type | |||
Set | AT+UHTTP=<profile_id>,4,<HTTP_authentication> | OK | AT+UHTTP=2,4,1 OK |
Read | AT+UHTTP=<profile_id>,4 | +UHTTP: <profile_id>,4,<HTTP_authentication> OK | AT+UHTTP=2,4 +UHTTP: 2,4,1 OK |
HTTP server port | |||
Set | AT+UHTTP=<profile_id>,5,<HTTP_port> | OK | AT+UHTTP=2,5,30 OK |
Read | AT+UHTTP=<profile_id>,5 | +UHTTP: <profile_id>,5,<HTTP_port> OK | AT+UHTTP=2,5 +UHTTP: 2,5,30 OK |
HTTP secure option | |||
Set | AT+UHTTP=<profile_id>,6,<HTTP_secure>[,<usecprf_profile_id>] | OK | AT+UHTTP=2,6,1 OK |
Read | AT+UHTTP=<profile_id>,6 | +UHTTP: <profile_id>,6,<HTTP_secure>[,<usecprf_profile_id>] OK | AT+UHTTP=2,6 +UHTTP: 2,6,1 OK |
HTTP request timeout and TCP socket linger timer | |||
Set | AT+UHTTP=<profile_id>,7,<HTTP_timeout>[,<linger_timer>] | OK | AT+UHTTP=2,7,150,5 OK |
Read | AT+UHTTP=<profile_id>,7 | +UHTTP: <profile_id>,7,<HTTP_timeout>,<linger_timer> OK | AT+UHTTP=2,7 +UHTTP: 2,7,150,5 OK |
HTTP add custom request headers | |||
Set | AT+UHTTP=<profile_id>,9,<custom_request_header> | OK | AT+UHTTP=2,9,"0:hdr0:val0" OK |
Read | AT+UHTTP=<profile_id>,9 | +UHTTP: <profile_id>,9,<custom_request_header> OK | AT+UHTTP=2,9 +UHTTP: 2,9,"0:hdr0:val0" OK |
HTTP output mode option | |||
Set | AT+UHTTP=<profile_id>,10,<output_mode> | OK | AT+UHTTP=0,10,1 OK |
Read | AT+UHTTP=<profile_id>,10 | +UHTTP: <profile_id>,10,<output_mode> OK | AT+UHTTP=0,10 +UHTTP: 0,10,1 OK |
HTTP split mode option | |||
Set | AT+UHTTP=<profile_id>,11,<split_mode> | OK | AT+UHTTP=0,11,1 OK |
Read | AT+UHTTP=<profile_id>,11 | +UHTTP: <profile_id>,11,<split_mode> OK | AT+UHTTP=0,11 +UHTTP: 0,11,1 OK |
HTTP context id | |||
Set | AT+UHTTP=<profile_id>,20,<cid>[,<preferred_protocol_type>] | OK | AT+UHTTP=2,20,2 OK |
Read | AT+UHTTP=<profile_id>,20 | +UHTTP: <profile_id>,20,<cid>,<preferred_protocol_type> OK | AT+UHTTP=2,20 +UHTTP: 2,20,2,0 OK |
Read | AT+UHTTP=<profile_id> | OK | AT+UHTTP=2 OK |
Test | AT+UHTTP=? | +UHTTP: (list of supported <profile_id>s),(list of supported <op_code>s) OK | +UHTTP: (0-3),(0-11,20) OK |
Parameter | Type | Description |
---|---|---|
<profile_id> | Number | See <profile_id>. |
<op_code> | Number | Allowed values:
Allowed values:
|
<HTTP_server_IP_address> | String | HTTP server IP address; The factory-programmed value is an empty text string. For IP address format reference see the IP addressing. |
<HTTP_server_name> | String | HTTP server name (e.g. "http.server.com"). The factory-programmed value is an empty text string. The maximum length is:
|
<username> | String | User name; the maximum length is 30 characters; it is used for the HTTP login procedure if the authentication is used. The factory-programmed value is an empty text string. |
<password> | String | Password used for the HTTP login procedure if the authentication is used:
The factory-programmed value is an empty text string. |
<HTTP_authentication> | Number | HTTP authentication method; the allowed values are:
|
<HTTP_port> | Number | HTTP server port; range 1-65535. It means the HTTP server port to be used in a HTTP request; the factory-programmed value is 80. |
<HTTP_secure> | Number | HTTP Secure option (SSL encryption). It enables or disables the HTTPS (SSL secured connection for HTTP application) usage:
|
<usecprf_profile_id> | Number | Defines the USECMNG profile which specifies the SSL/TLS properties to be used for the SSL/TLS connection. The range goes from 0 to 4. If no profile is set a default USECMNG profile is used |
<HTTP_timeout> | Number | HTTP request timeout in seconds (number); the range is 30 - 180. It is the timeout in seconds to be used for all the HTTP requests with the specified profile. The factory-programmed value is 180 s. |
<linger_timer> | Number | TCP linger timer for socket close expressed in seconds (number). |
<custom_request_header> | String | Sets/clears the custom request header (string); the custom header option follows a defined format "hdr_id:hdr_name:hdr_value"; the hdr_id is a number in the range [0-4]; the hdr_name and hdr_value are strings (see examples below).
The following character is not allowed in the <custom_request_header> parameter:
The hdr_name and hdr_value each have a maximum length of:
|
<output_mode> | Number | HTTP output mode; the allowed values are:
|
<split_mode> | Number | HTTP split mode; the allowed values are:
|
<cid> | Number | Specifies the PDP context that will be used for the HTTP data. For the parameter range, see <cid>. For more details on the default value of the parameter (where supported), see HTTP. |
<preferred_protocol_type> | Number | In case of a context id with IPv4v6 PDP type it is possible to select:
For more details on the default value of the parameter (where supported), see HTTP. |
<param_val> | Number / String | Type and supported content depend on the related <op_code> parameter; details are given above |
<param_val1> | Number / String | Type and supported content depend on the related <op_code> parameter; details are given above. |
HTTP server IP address and HTTP server name are mutually exclusive. If the HTTP server IP address is specified by the user, then the value for the HTTP server name is reset, or vice versa.
The <linger_timer> parameter is not supported.
+UHTTPAC | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No | - |
Configures, reads or resets (to the factory-programmed values) the HTTP application profile advanced parameters.
The configured HTTP profile advanced parameters are not saved in the non volatile memory.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+UHTTPAC=<profile_id>,<param_tag>,<key>,<value> | OK | AT+UHTTPAC=0,0,0,"UBLX_SESSION_COOKIE_0" OK |
Read | AT+UHTTPAC=<profile_id>,<param_tag>,<key> | +UHTTPAC: <profile_id>,<param_tag>,<key>,<value> OK | AT+UHTTPAC=0,0,0 +UHTTPAC: 0,0,0,"UBLX_SESSION_COOKIE_0" OK |
Test | AT+UHTTPAC=? | +UHTTPAC: (list of supported <profile_id>s),(list of supported <param_tag>s),(list of supported <key>s) OK | +UHTTPAC: (0-3),(0),(0-3) OK |
Parameter | Type | Description |
---|---|---|
<profile_id> | Number | See <profile_id>. |
<param_tag> | Number |
|
<key> | Number/String | Content depends on the related <param_tag> (see above). |
<value> | Number/String | Content depends on the related <param_tag> (see above). |
In this section some +UHTTPAC AT command examples and use cases are listed.
Command | Response | Description |
---|---|---|
Example 1 | ||
AT+UHTTPAC=0,0,0,”” | OK | Clear the HTTP request cookie at index 0. |
Example 2 | ||
AT+UHTTPAC=0,0,0,”SIMPLE_COOKIE” | OK | Set a simple HTTP request cookie at index 0. |
Example 3 | ||
AT+UHTTPAC=0,0,0,”COMPLEX_COOKIE; COMPLEX_COOKIE” | OK | Overwrite the HTTP request cookie at index 0 with a complex cookie. |
+UHTTPC | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
partial | No | No | No | - |
Triggers the HTTP command specified with <http_command> parameter, using the HTTP application profile parameters (previously set up by +UHTTP AT command), specified with <profile_id>. The response indicates if sending the command request to HTTP process was successful or not. The final result of HTTP command will be returned to the user via the +UUHTTPCR URC.
HTTP can be used also in direct link mode when available. In this mode, module will handle the initial steps of the HTTP protocol sending HTTP header for request issued. In this case it will establish a transparent end-to-end communication with the data connection TCP socket via the serial interface. After the CONNECT result code, the user can send the content via the serial interface. Once finished, the server will replies using same serial interface. Every operation can be aborted using the
server, user must wait at least 2 s before sending the +++ abort sequence.
The timing before the +UUHTTPCR URC is issued on the AT terminal also depends by the DNS resolution. For further details about the estimated response time related to the DNS resolution, see the +UDNSRN AT command.
Type | Syntax | Response | Example |
---|---|---|---|
Generic syntax | |||
Set | AT+UHTTPC=<profile_id>,<http_command>,<path>,<filename>[,<param1>[,<param2>[,<param3>]]] | OK | AT+UHTTPC=0,1,"/path/file.html","responseFilename" OK |
HEAD command | |||
Set | AT+UHTTPC=<profile_id>,0,<path>,<filename> | OK | AT+UHTTPC=0,0,"/path/file.html","responseFilename" OK |
GET command | |||
Set | AT+UHTTPC=<profile_id>,1,<path>,<filename> | OK | AT+UHTTPC=0,1,"/path/file.html","responseFilename" OK |
DELETE command | |||
Set | AT+UHTTPC=<profile_id>,2,<path>,<filename> | OK | AT+UHTTPC=0,2,"/path/file.html","responseFilename" OK |
PUT command | |||
Set | AT+UHTTPC=<profile_id>,3,<path>,<filename>,<filesystem_name>[,<HTTP_content_type>[,<user_defined_content_type>]] | OK | AT+UHTTPC=0,3,"/path/file.html","responseFilename","filesystemName" OK |
POST file command | |||
Set | AT+UHTTPC=<profile_id>,4,<path>,<filename>,<filesystem_name>,<HTTP_content_type>[,<user_defined_content_type>] | OK | AT+UHTTPC=0,4,"/path/file.html","responseFilename","filesystemName",0 OK |
POST data command | |||
Set | AT+UHTTPC=<profile_id>,5,<path>,<filename>,<data>,<HTTP_content_type>[,<user_defined_content_type>] | OK | AT+UHTTPC=0,5,"/path/file.html","responseFilename","data",0 OK |
PUT command in direct link | |||
Set | AT+UHTTPC=<profile_id>,6,<path>,[<HTTP_content_type>],[<user_defined_content_type>],<data_length> | OK | AT+UHTTPC=0,6,"/path/file.html",1,,30 CONNECT <data> <http_server_reply> DISCONNECT OK |
POST command in direct link | |||
Set | AT+UHTTPC=<profile_id>,7,<path>,[<HTTP_content_type>],[<user_defined_content_type>],<data_length> | OK | AT+UHTTPC=0,7,"/path/file.html",1,,30 <data> <http_server_reply> DISCONNECT OK |
GET FOTA update file | |||
Set | AT+UHTTPC=<profile_id>,100,<path> | OK | AT+UHTTPC=0,100,"/path/file.html" OK |
Test | AT+UHTTPC=? | +UHTTPC: (list of supported <profile_id>s),(list of supported <http_command>s) OK | +UHTTPC: (0-3),(0-5,100) OK |
URC | +UUHTTPCR: <profile_id>,<http_command>,<http_result>[,<http_status_code>,<md5_sum>] | +UUHTTPCR: 0,1,1 |
Parameter | Type | Description |
---|---|---|
<profile_id> | Number | See <profile_id>. |
<http_command> | Number |
Allowed values:
|
<path> | String | Path of HTTP server resource; the maximum length is:
|
<filename> | String | Filename where the HTTP server response will be stored. If the file already exists, it will be overwritten. If the parameter is an empty string (""), the default "http_last_response_<profile_id>" filename will be used. For file system file name and data size limits see File system limits. |
<filesystem_name> | String | File system filename representing the file system filename to be sent to the HTTP server within the POST / PUT request. For file system file name and data size limits see File system limits. |
<HTTP_content_type> | Number | HTTP Content-Type identifier. It represents the HTTP Content-Type identifier. Allowed values:
|
<user_defined_content_type> | String | Used only when <HTTP_content_type>=6 (user defined Content-Type). The maximum length is
|
<data> | String | It represents the data to be sent to the HTTP server with the POST request. The data must be formatted according to the Content-Type specified in <HTTP_content_type> parameter. The maximum length is:
|
<data_length> | String | It represents total data that will be sent with direct link PUT/POST request. After this threshold is achieved, further data will be ignored. User can use abort sequence +++ to stop data transfert waiting at least 2s. |
<param1> | String | Content depends on the related <http_command> (see above). |
<param2> | Number | Content depends on the related <http_command> (see above). |
<param3> | String | Content depends on the related <http_command> (see above). |
<http_result> | Number |
|
<http_status_code> | Number | HTTP status code reported in the server response header after a GET FOTA update file request. This parameter is issued only for AT+UHTTPC=<profile_id>,100,<path> AT command. |
<md5_sum> | String | MD5 checksum of the FOTA update file. This parameter is issued only for AT+UHTTPC=<profile_id>,100,<path> AT command. |
The +UHTTPC command has a default timeout setting set to 180 s. The timeout is counted from the last successful network read or send operation performed by the HTTP application, so in a real timeout case the application might be executing a command more than 180 s.
If <http_command>=4 (POST a file) and the <HTTP_content_type>=3 (multipart/form-data), then the module automatically encapsulates the file content in the following multipart/form-data HTTP request:
--U1Blox2Http3Unique4Boundary5\r\n Content-Disposition: form-data; name="file_post"; filename="<user_defined_content_type>"\r\n Content-Length: <length of file specified with <user_defined_content_type>>\r\n Content-Type: application/octet-stream\r\n \r\n <content of file specified with <user_defined_content_type>>\r\n --U1Blox2Http3Unique4Boundary5--\r\n \r\n
The response headers string (headers received in the HTTP response) must not exceed the maximum length of 255 bytes.
Only one direct link connection at a time can be activated. When considering the number of active direct links, take into account also the connection established by the +USODL AT command, the UMQTT binary mode (see parameter op_code=9 in +UMQTTC to publish a binary message to a topic), the +USOWR AT command for binary mode and +FREAD AT command.
For <http_command> 0(HEAD), 1(GET) and 2(DELETE), when direct link mode is selected(+UHTTP: <profile_id>,10,1), <filename> parameter is ignored.
+UHTTPER | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No | - |
Retrieves the error class and code of the latest HTTP operation on the specified HTTP profile.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+UHTTPER=<profile_id> | +UHTTPER: <profile_id>,<error_class>,<error_code> OK | AT+UHTTPER=1 +UHTTPER: 1,0,0 OK |
Parameter | Type | Description |
---|---|---|
<profile_id> | Number | See <profile_id>. |
<error_class> | Number | List of the allowed values is available in Internet suite error classes |
<error_code> | Number | Value of class-specific error codes (reply code if class is 0). When <error_class>=10 (wrong HTTP API usage), the allowed <error_code>; values are listed in HTTP class error codes |
+UHTTPNV | ||||||
Modules | LEXI-R10401D-00B LEXI-R10801D-00B | |||||
Attributes | Syntax | PIN required | Settings saved | Can be aborted | Response time | Error reference |
full | No | No | No | - |
Either saves all of the HTTP client profile parameters to NVM (non-volatile memory) or sets all of the HTTP client profile parameters to either factory-programmed or non-volatile stored values.
For the complete list of parameters that can be stored in the NVM, see the +UHTTP and +UHTTPAC AT commands.
Type | Syntax | Response | Example |
---|---|---|---|
Set | AT+UHTTPNV=<profile_id>,<NVM_mode> | OK | AT+UHTTPNV=0,2 OK |
Read | AT+UHTTPNV? | +UHTTPNV: <profile_id>,<NVM_status> OK | AT+UHTTPNV? +UHTTPNV: 0,1 OK |
Test | AT+UHTTPNV=? | +UHTTPNV: (allowed <profile_id>),(list of <NVM_mode>s) OK | +UHTTPNV: 0,(0-2) OK |
Parameter | Type | Description |
---|---|---|
<profile_id> | Number | See <profile_id>. |
<NVM_mode> | Number | Operation to set or save the HTTP client profile parameters as follows:
|
<NVM_status> | Number | Reports if configuration is loaded/stored from/to NVM as follow:
Value is set to 0 on boot and if +UHTTPNV: <profile_id>,0 is addressed. |