This section contains APIs used for communication through HTTP protocol. 

rsi_http_client_get_async

Prototype int32_t rsi_http_client_get_async(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,void(*http_client_get_response_handler) (uint16_t status,const uint8_t *buffer,const uint16_t length, const uint32_t more_data));
Input Arguments uint8_t flags: To select IP version and security

BIT(0) – RSI_IPV6

Set this bit to enable IPv6 , by default it is configured to IPv4

BIT(1) – RSI_SSL_ENABLE

Set this bit to enable SSL feature

uint8_t *ip_address: server IP address

uint16_t port: port number of HTTP server

Note : HTTP server port is configurable on non standard port also

uint8_t *resource: URL string for requested resource

uint8_t *host_name: host name

uint8_t *extended_header: user defined extended header

uint8_t *user_name: username for server Authentication

uint8_t *password: password for server Authentication

void(*http_client_get_response_handler): callback when asynchronous response comes for the request

parameters: status , buffer, length, more_data

status:status code

buffer: buffer pointer

length: length of data

more_data: if 1 – No more data

0 – more data present

Return Value
  • On Success :  0
  • On Failure   :
  • if return value is less than 0
  • -2 : invalid parameters , call back not registered
  • -3 : Command given in wrong state
  • -4 : Buffer not available to serve the command
  • if return value is greater than 0
  • These responses may be observed as asynchronous message in the response handler  function
  • 0x0021,0x002C,0x0015,0x0025,0xFF74,0xBBF0
  • Please refer Error Codesfor description of above error codes.
Description This API is used to send http get request to remote HTTP server.
Example Usage rsi_http_client_get_async((uint8_t)flags,(uint8_t*)HTTP_SERVER_IP_ADDRESS,(uint16_t)HTTP_PORT,(uint8_t*)HTTP_URL,(uint8_t*)HTTP_HOSTNAME,(uint8_t*)HTTP_EXTENDED_HEADER, (uint8_t*)USERNAME,(uint8_t*)PASSWORD,rsi_http_get_response_handler);

rsi_http_client_post_async

Prototype int32_t rsi_http_client_post_async(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,uint16_t post_data_length,void(*http_client_post_response_handler)(uint16_t status,const uint8_t *buffer,const uint16_t lengthconst uint32_t more_data));
Input Arguments uint8_t flags: To select IP version and security

BIT(0) – RSI_IPV6

Set this bit to enable IPv6 , by default it is configured to IPv4

BIT(1) – RSI_SSL_ENABLE

Set this bit to enable SSL feature

uint8_t *ip_address: server IP address

uint16_t port: port number of HTTP server

uint8_t *resource: URL string for requested resource

uint8_t *host_name: host name

uint8_t *extended_header: user defined extended header

uint8_t *user_name: username for server Authentication

uint8_t *password: password for server Authentication

uint8_t *post_data: HTTP data to be posted to server

uint16_t post_data_length: post data length

void(*http_client_post_response_handler): callback when asynchronous response comes for the request

parameters: status , buffer, length, more_data

status:status code

buffer: buffer pointer

length: length of data

more_data: if 1 – No more data

0 – more data present

Return Value
  • On Success :  0
  • On Failure   :
  • if return value is less than 0
  • -2 : invalid parameters , call back not registered
  • -3 : Command given in wrong state
  • -4 : Buffer not available to serve the command
  • if return value is greater than 0
  • These responses may be observed as asynchronous message in the response handler  function
  • 0x0021,0x002C,0x0015,0x0025,0xFF74,0xBBF0
  • Please refer Error Codesfor description of above error codes.
Description This API is used to send http post request to remote HTTP server.
Example Usage rsi_http_client_post_async((uint8_t)FLAGS,

(uint8_t *)HTTP_SERVER_IP_ADDRESS, (uint16_t)HTTP_PORT, (uint8_t *)HTTP_URL, (uint8_t*)HTTP_HOSTNAME,(uint8_t*)HTTP_EXTENDED_HEADER, (uint8_t*)USERNAME(uint8_t*)PASSWORD,(uint8_t*)HTTP_DATA , strlen(HTTP_DATA), rsi_http_post_response_handler);

rsi_http_client_abort

Prototype int32_t rsi_http_client_abort(void)
Input Arguments void : None
Return Value
  • On Success :  0
  • On Failure   :
  • if return value is less than 0
  • -3 : Command given in wrong state
  • -4 : Buffer not available to serve the command
  • if return value is greater than 0
  • 0x0021,0x002C,0x0015
  • Please referError Codes for description of above error codes.
Description This API is used to abort any ongoing HTTP request from  the client.
Example Usage rsi_http_client_abort();