HTTP Client#
Functions#
Create HTTP server credentials request. Set username and password for HTTP server. This is a blocking API.
Send HTTP get request to remote HTTP server. This is a non-blocking API.
Send HTTP post request to remote HTTP server. This is a non-blocking API.
Send HTTP get request/HTTP post request to remote HTTP server based on the type selected. This is a non-blocking API.
Abort ongoing HTTP request from the client. This is a blocking API.
Create the HTTP PUT client. This is a blocking API.
Delete the created HTTP PUT client. This is a non-blocking API.
Start the HTTP client PUT process. This is a non-blocking API.
Send HTTP data to HTTP server for the created URL resource. This is a blocking API.
Send the HTTP POST data packet to remote HTTP server. This is a non-blocking API.
Post the HTTP data for the requested URL to HTTP server. This is a non-blocking API.
Function Documentation#
rsi_http_credentials#
int32_t rsi_http_credentials (int8_t * username, int8_t * password)
Create HTTP server credentials request. Set username and password for HTTP server. This is a blocking API.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| int8_t * | [in] | username | - User-given username  | 
| int8_t * | [in] | password | - User-given password  | 
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffd)
Note
Precondition - rsi_wireless_init() API needs to be called before this API.
rsi_http_client_get_async#
int32_t rsi_http_client_get_async (uint16_t flags, uint8_t * ip_address, uint16_t port, uint8_t * resource, uint8_t * host_name, uint8_t * extended_header, uint8_t * user_name, uint8_t * password, #if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) http_client_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) http_client_response_handler # endif, status, buffer, length, more_data, status_code)
Send HTTP get request to remote HTTP server. This is a non-blocking API.
| Type | Direction | Argument Name | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| uint16_t | [in] | flags | - Select version and security  
  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | ip_address | - Server IP address  | ||||||||||||||||||||||||||||||
| uint16_t | [in] | port | - Port number of HTTP server  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | resource | - URL string for requested resource  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | host_name | - Host name  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | extended_header | - User-defined extended header, each member header should end by \r  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | user_name | - Username for server authentication  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | password | - Password for server authentication  | ||||||||||||||||||||||||||||||
| #if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) http_client_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) http_client_response_handler # | [in] | endif | - Callback when asynchronous response comes for the request  | ||||||||||||||||||||||||||||||
| [out] | status | - Status of response from module. This will return failure upon an internal error only.  | |||||||||||||||||||||||||||||||
| [out] | buffer | - Buffer pointer  | |||||||||||||||||||||||||||||||
| [out] | length | - Length of data  | |||||||||||||||||||||||||||||||
| [out] | more_data | - 1 No more data,   | |||||||||||||||||||||||||||||||
| [out] | status_code | - HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc.   | 
Returns
0 - Success
Negative value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
HTTP server port is configurable on non-standard port.
Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0.
Refer to Error Codes for the description of above error codes.
rsi_http_client_post_async#
int32_t rsi_http_client_post_async (uint16_t flags, uint8_t * ip_address, uint16_t port, uint8_t * resource, uint8_t * host_name, uint8_t * extended_header, uint8_t * user_name, uint8_t * password, uint8_t * post_data, uint32_t post_data_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) http_client_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) http_client_response_handler # endif, status, buffer, length, moredata, status_code)
Send HTTP post request to remote HTTP server. This is a non-blocking API.
| Type | Direction | Argument Name | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| uint16_t | [in] | flags | - Select version and security  
  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | ip_address | - Server IP address  | ||||||||||||||||||||||||||||||
| uint16_t | [in] | port | - Port number of HTTP server  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | resource | - URL string for requested resource  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | host_name | - Host name  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | extended_header | - User-defined extended header, each member header should end by \r  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | user_name | - Username for server authentication  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | password | - Password for server authentication  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | post_data | - HTTP data to be posted to server  | ||||||||||||||||||||||||||||||
| uint32_t | [in] | post_data_length | - Post data length  | ||||||||||||||||||||||||||||||
| #if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) http_client_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) http_client_response_handler # | [in] | endif | - Callback when asynchronous response comes for the request  | ||||||||||||||||||||||||||||||
| [in] | status | - Status of response from module. This will return failure upon an internal error only.  | |||||||||||||||||||||||||||||||
| [in] | buffer | - Buffer pointer  | |||||||||||||||||||||||||||||||
| [in] | length | - Length of data  | |||||||||||||||||||||||||||||||
| [in] | moredata | - 1 No more data, 0 More data present, 2 HTTP post success response  | |||||||||||||||||||||||||||||||
| [in] | status_code | HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc.   | 
Returns
0 - Success
Negative value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0.
Refer to Error Codes for the description of above error codes.
rsi_http_client_async#
int32_t rsi_http_client_async (uint8_t type, uint16_t flags, uint8_t * ip_address, uint16_t port, uint8_t * resource, uint8_t * host_name, uint8_t * extended_header, uint8_t * user_name, uint8_t * password, uint8_t * post_data, uint32_t post_data_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) callback #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) callback # endif, status, buffer, length, moredata, status_code)
Send HTTP get request/HTTP post request to remote HTTP server based on the type selected. This is a non-blocking API.
| Type | Direction | Argument Name | Description | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| uint8_t | [in] | type | - 0 RSI_HTTP_GET, 1 RSI_HTTP_POST  | ||||||||||||||||||||||||||||||
| uint16_t | [in] | flags | - Select version and security  
  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | ip_address | - Server IP address  | ||||||||||||||||||||||||||||||
| uint16_t | [in] | port | - Port number of HTTP server  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | resource | - URL string for requested resource.   | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | host_name | - Host name  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | extended_header | - User-defined extended header, each member header should end by \r  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | user_name | - Username for server authentication  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | password | - Password for server authentication  | ||||||||||||||||||||||||||||||
| uint8_t * | [in] | post_data | - HTTP data to be posted to server  | ||||||||||||||||||||||||||||||
| uint32_t | [in] | post_data_length | - This is the post data length  | ||||||||||||||||||||||||||||||
| #if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) callback #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) callback # | [in] | endif | - Callback when asyncronous response comes for the request  | ||||||||||||||||||||||||||||||
| [out] | status | - Status of response from module. This will return failure upon an internal error only.  | |||||||||||||||||||||||||||||||
| [out] | buffer | - Buffer pointer  | |||||||||||||||||||||||||||||||
| [out] | length | - Length of data  | |||||||||||||||||||||||||||||||
| [out] | moredata | - 1 - No more data, 0 - More data present  | |||||||||||||||||||||||||||||||
| [in] | status_code | HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc.   | 
Returns
0 - Success
Negative value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0.
Refer to Error Codes for the description of above error codes.
rsi_http_client_abort#
int32_t rsi_http_client_abort (void )
Abort ongoing HTTP request from the client. This is a blocking API.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| void | [in] | 
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
rsi_http_client_put_create#
int32_t rsi_http_client_put_create (void )
Create the HTTP PUT client. This is a blocking API.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| void | [in] | 
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
rsi_http_client_put_delete#
int32_t rsi_http_client_put_delete (void )
Delete the created HTTP PUT client. This is a non-blocking API.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| void | [in] | 
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API.
Refer to Error Codes for the description of above error codes.
rsi_http_client_put_start#
int32_t rsi_http_client_put_start (uint16_t flags, uint8_t * ip_address, uint32_t port_number, uint8_t * resource, uint8_t * host_name, uint8_t * extended_header, uint8_t * user_name, uint8_t * password, uint32_t content_length, void(*)(uint16_t status, uint8_t type, const uint8_t *buffer, uint16_t length, const uint8_t end_of_put_pkt) callback, callback, status, type, buffer, length, end_of_put_pkt)
Start the HTTP client PUT process. This is a non-blocking API.
| Type | Direction | Argument Name | Description | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| uint16_t | [in] | flags | - Select version and security  
  | |||||||||||||||||||||||||||||||||
| uint8_t * | [in] | ip_address | - Server IP address  | |||||||||||||||||||||||||||||||||
| uint32_t | [in] | port_number | - Port number of HTTP server  | |||||||||||||||||||||||||||||||||
| uint8_t * | [in] | resource | - URL string for requested resource  | |||||||||||||||||||||||||||||||||
| uint8_t * | [in] | host_name | - Host name  | |||||||||||||||||||||||||||||||||
| uint8_t * | [in] | extended_header | - User-defined extended header, each member header should end by \r  | |||||||||||||||||||||||||||||||||
| uint8_t * | [in] | user_name | - Username for server authentication  | |||||||||||||||||||||||||||||||||
| uint8_t * | [in] | password | - Password for server authentication  | |||||||||||||||||||||||||||||||||
| uint32_t | [in] | content_length | - Total length of HTTP data  | |||||||||||||||||||||||||||||||||
| void(*)(uint16_t status, uint8_t type, const uint8_t *buffer, uint16_t length, const uint8_t end_of_put_pkt) | [in] | callback | - HTTP data length to be posted to server  | |||||||||||||||||||||||||||||||||
| [in] | callback | - Callback when asyncronous response comes for the request  | ||||||||||||||||||||||||||||||||||
| [in] | status | - Status code  | ||||||||||||||||||||||||||||||||||
| [in] | type | - HTTP Client PUT command type.   | ||||||||||||||||||||||||||||||||||
| [in] | buffer | - Buffer pointer  | ||||||||||||||||||||||||||||||||||
| [in] | length | - Length of data  | ||||||||||||||||||||||||||||||||||
| [in] | end_of_put_pkt | - End of file or HTTP resource content.   | 
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress() API and rsi_http_client_put_create API needs to be called before this API.
Leave both HTTPS_CERT_INDEX_1, HTTPS_CERT_INDEX_2 unset for certificate index 0.
Refer to Error Codes for the description of above error codes.
rsi_http_client_put_pkt#
int32_t rsi_http_client_put_pkt (uint8_t * file_content, uint16_t current_chunk_length)
Send HTTP data to HTTP server for the created URL resource. This is a blocking API.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| uint8_t * | [in] | file_content | - HTTP data content  | 
| uint16_t | [in] | current_chunk_length | - HTTP data current chunk length  | 
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress(), rsi_http_client_put_create() and rsi_http_client_put_start() needs to be called before this API
Refer to Error Codes for the description of above error codes.
rsi_http_client_post_data#
int32_t rsi_http_client_post_data (uint8_t * file_content, uint16_t current_chunk_length, #if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) rsi_http_post_data_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) rsi_http_post_data_response_handler # endif, status, buffer, length, more_data, status_code)
Send the HTTP POST data packet to remote HTTP server. This is a non-blocking API.
| Type | Direction | Argument Name | Description | 
|---|---|---|---|
| uint8_t * | [in] | file_content | - User given http file content  | 
| uint16_t | [in] | current_chunk_length | - Length of the current HTTP data  | 
| #if RSI_HTTP_STATUS_INDICATION_EN void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata, uint16_t status_code) rsi_http_post_data_response_handler #else void(*)(uint16_t status, const uint8_t *buffer, const uint16_t length, const uint32_t moredata) rsi_http_post_data_response_handler # | [in] | endif | - Callback when asynchronous response comes for the request.  | 
| [in] | status | - Status of response from module. This will return failure upon an internal error only.  | |
| [in] | buffer | - Buffer pointer  | |
| [in] | length | - Length of data  | |
| [in] | more_data | - 4 - More data is pending from host.   | |
| [in] | status_code | - HTTP response code as returned by server in HTTP header. e.g., 200, 201, 404, etc.   | 
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc)
Note
Precondition - rsi_config_ipaddress() API needs to be called before this API
Refer to Error Codes for the description of above error codes.
rsi_http_otaf_async#
int32_t rsi_http_otaf_async (uint8_t type, uint8_t flags, uint8_t * ip_address, uint16_t port, uint8_t * resource, uint8_t * host_name, uint8_t * extended_header, uint8_t * user_name, uint8_t * password, uint8_t * post_data, uint32_t post_data_length, void(*)(uint16_t status, const uint8_t *buffer) callback, buffer, status)
Post the HTTP data for the requested URL to HTTP server. This is a non-blocking API.
| Type | Direction | Argument Name | Description | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| uint8_t | [in] | type | - 0 - HTTPGET  
  | |||||||||||||||||||||
| uint8_t | [in] | flags | - Select version and security: 
  | |||||||||||||||||||||
| uint8_t * | [in] | ip_address | - Server IP address  | |||||||||||||||||||||
| uint16_t | [in] | port | - Port number, default : 80 - HTTP, 443 - HTTPS  | |||||||||||||||||||||
| uint8_t * | [in] | resource | - URL string for requested resource  | |||||||||||||||||||||
| uint8_t * | [in] | host_name | - Post name  | |||||||||||||||||||||
| uint8_t * | [in] | extended_header | - Extender header if present, after each header member append \r  | |||||||||||||||||||||
| uint8_t * | [in] | user_name | - Username for server Authentication  | |||||||||||||||||||||
| uint8_t * | [in] | password | - Password for server Authentication  | |||||||||||||||||||||
| uint8_t * | [in] | post_data | - HTTP data to be posted to server  | |||||||||||||||||||||
| uint32_t | [in] | post_data_length | - HTTP data length to be posted to server  | |||||||||||||||||||||
| void(*)(uint16_t status, const uint8_t *buffer) | [in] | callback | - Callback is called when asynchronous response is received from module for HTTP firmware update request  | |||||||||||||||||||||
| [out] | buffer | - NULL  | ||||||||||||||||||||||
| [out] | status | - This is the status response from module. This returns failure upon an internal error only.  | 
Returns
0 - Success
Negative Value - Failure (Possible Error Codes - 0xfffffffe, 0xfffffffd, 0xfffffffc)
Note
Refer to Error Codes for the description of above error codes.