Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: STM32F746_iothub_client_sample_mqtt f767zi_mqtt iothub_client_sample_amqp iothub_client_sample_http ... more
httpapiex.h File Reference
This is a utility module that provides HTTP requests with build-in retry capabilities. More...
Go to the source code of this file.
Functions | |
| DEFINE_ENUM (HTTPAPIEX_RESULT, HTTPAPIEX_RESULT_VALUES) | |
| Enumeration specifying the status of calls to various APIs in this module. | |
| MOCKABLE_FUNCTION (, HTTPAPIEX_HANDLE, HTTPAPIEX_Create, const char *, hostName) | |
Creates an HTTPAPIEX_HANDLE that can be used in further calls. | |
| MOCKABLE_FUNCTION (, HTTPAPIEX_RESULT, HTTPAPIEX_ExecuteRequest, HTTPAPIEX_HANDLE, handle, HTTPAPI_REQUEST_TYPE, requestType, const char *, relativePath, HTTP_HEADERS_HANDLE, requestHttpHeadersHandle, BUFFER_HANDLE, requestContent, unsigned int *, statusCode, HTTP_HEADERS_HANDLE, responseHttpHeadersHandle, BUFFER_HANDLE, responseContent) | |
| Tries to execute an HTTP request. | |
| MOCKABLE_FUNCTION (, void, HTTPAPIEX_Destroy, HTTPAPIEX_HANDLE, handle) | |
Frees all resources used by the HTTPAPIEX_HANDLE object. | |
| MOCKABLE_FUNCTION (, HTTPAPIEX_RESULT, HTTPAPIEX_SetOption, HTTPAPIEX_HANDLE, handle, const char *, optionName, const void *, value) | |
Sets the option optionName to the value pointed to by value. | |
Detailed Description
This is a utility module that provides HTTP requests with build-in retry capabilities.
HTTAPIEX is a utility module that provides HTTP requests with build-in retry capability to an HTTP server. Features over "regular" HTTPAPI include:
- Optional parameters
- Implementation independent
- Retry mechanism
- Persistent options
Definition in file httpapiex.h.
Function Documentation
| DEFINE_ENUM | ( | HTTPAPIEX_RESULT | , |
| HTTPAPIEX_RESULT_VALUES | |||
| ) |
Enumeration specifying the status of calls to various APIs in this module.
| MOCKABLE_FUNCTION | ( | HTTPAPIEX_RESULT | , |
| HTTPAPIEX_SetOption | , | ||
| HTTPAPIEX_HANDLE | , | ||
| handle | , | ||
| const char * | , | ||
| optionName | , | ||
| const void * | , | ||
| value | |||
| ) |
Sets the option optionName to the value pointed to by value.
- Parameters:
-
handle The HTTPAPIEX_HANDLErepresenting this session.optionName Name of the option. value The value to be set for the option.
- Returns:
- An
HTTPAPIEX_RESULTindicating the status of the call.
| MOCKABLE_FUNCTION | ( | void | , |
| HTTPAPIEX_Destroy | , | ||
| HTTPAPIEX_HANDLE | , | ||
| handle | |||
| ) |
Frees all resources used by the HTTPAPIEX_HANDLE object.
- Parameters:
-
handle The HTTPAPIEX_HANDLEobject to be freed.
| MOCKABLE_FUNCTION | ( | HTTPAPIEX_RESULT | , |
| HTTPAPIEX_ExecuteRequest | , | ||
| HTTPAPIEX_HANDLE | , | ||
| handle | , | ||
| HTTPAPI_REQUEST_TYPE | , | ||
| requestType | , | ||
| const char * | , | ||
| relativePath | , | ||
| HTTP_HEADERS_HANDLE | , | ||
| requestHttpHeadersHandle | , | ||
| BUFFER_HANDLE | , | ||
| requestContent | , | ||
| unsigned int * | , | ||
| statusCode | , | ||
| HTTP_HEADERS_HANDLE | , | ||
| responseHttpHeadersHandle | , | ||
| BUFFER_HANDLE | , | ||
| responseContent | |||
| ) |
Tries to execute an HTTP request.
- Parameters:
-
handle A valid HTTPAPIEX_HANDLEvalue.requestType A value from the HTTPAPI_REQUEST_TYPE enum. relativePath Relative path to send the request to on the server. requestHttpHeadersHandle Handle to the request HTTP headers. requestContent The request content. statusCode If non-null, the HTTP status code is written to this pointer. responseHttpHeadersHandle Handle to the response HTTP headers. responseContent The response content.
HTTPAPIEX_ExecuteRequest tries to execute an HTTP request of type requestType, on the server's relativePath, pushing the request HTTP headers requestHttpHeadersHandle, having the content of the request as pointed to by requestContent. If successful, HTTAPIEX_ExecuteRequest writes in the out parameter statusCode the HTTP status, populates the responseHeadersHandle with the response headers and copies the response body to responseContent.
- Returns:
- An
HTTAPIEX_HANDLEsuitable for further calls to the module.
| MOCKABLE_FUNCTION | ( | HTTPAPIEX_HANDLE | , |
| HTTPAPIEX_Create | , | ||
| const char * | , | ||
| hostName | |||
| ) |
Creates an HTTPAPIEX_HANDLE that can be used in further calls.
- Parameters:
-
hostName Pointer to a null-terminated string that contains the host name of an HTTP server.
If hostName is NULL then HTTPAPIEX_Create returns NULL. The hostName value is saved and associated with the returned handle. If creating the handle fails for any reason, then HTTAPIEX_Create returns NULL. Otherwise, HTTPAPIEX_Create returns an HTTAPIEX_HANDLE suitable for further calls to the module.
- Returns:
- An
HTTAPIEX_HANDLEsuitable for further calls to the module.
Generated on Wed Jul 13 2022 23:38:02 by
1.7.2