Sends the HTTP request to the host and handles the response for the HTTP call.
HTTPAPI_RESULT HTTPAPI_ExecuteRequest( HTTP_HANDLE handle, HTTPAPI_REQUEST_TYPE requestType, const char * relativePath, HTTP_HEADERS_HANDLE httpHeadersHandle, const unsigned char * content, size_t contentLength, unsigned int * statusCode, HTTP_HEADERS_HANDLE responseHeadersHandle, BUFFER_HANDLE responseContent );
handleThe handle to the HTTP connection created via HTTPAPI_CreateConnection.
requestTypeSpecifies which HTTP method is used (GET, POST, DELETE, PUT, PATCH).
relativePathSpecifies the relative path of the URL excluding the host name.
httpHeadersHandleSpecifies a set of HTTP headers (name-value pairs) to be added to the HTTP request. The httpHeadersHandle handle can be created and setup with the proper name-value pairs by using the HTTPHeaders APIs available in HTTPHeaders.h.
contentSpecifies a pointer to the request body. This value is optional and can be NULL.
contentLengthSpecifies the request body size (this is typically added into the HTTP headers as the Content-Length header). This value is optional and can be 0.
statusCodeThis is an out parameter, where HTTPAPI_ExecuteRequest returns the status code from the HTTP response (200, 201, 400, 401, etc.)
responseHeadersHandleThis is an HTTP headers handle to which HTTPAPI_ExecuteRequest must add all the HTTP response headers so that the caller of HTTPAPI_ExecuteRequest can inspect them. You can manipulate responseHeadersHandle by using the HTTPHeaders APIs available in HTTPHeaders.h
responseContentThis is a buffer that must be filled by HTTPAPI_ExecuteRequest with the contents of the HTTP response body. The buffer size must be increased by the HTTPAPI_ExecuteRequest implementation in order to fit the response body. HTTPAPI_ExecuteRequest must also handle chunked transfer encoding for HTTP responses. To manipulate the responseContent buffer, use the APIs available in Strings.h.
HTTPAPI_OK if the API call is successful or an error code in case it fails.