Sending POST Requests
This section describes how to send POST requests synchronously. During the request sending process, the threads are blocked until the requests are sent successfully. The TLS1.2 security protocol is supported, and the timeout period is set to 20 seconds.
API Calling
int hilens::POST(const std::string & url, const Json::Value & body, long & httpcode, std::string * response = NULL, POSTHeaders * headers = NULL)
Parameter Description
Parameter |
Description |
---|---|
url |
Uniform resource locator |
body |
JSON object of the message body |
httpcode |
The return value of the HTTP request. If the Return Value is 200, the request is sent successfully. If the return value is 404, the requested page does not exist. |
response |
Response. This parameter can be left blank. |
headers |
Request header. If this parameter is left blank, the header is ignored. typedef std::vector<std::string> hilens::POSTHeaders The header of a called POST request can be transferred as a POST parameter (for example, headers.push_back("Content-Type: application/json"). |
Return Value
Return value of cURL. The value 0 indicates the operation is successful.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot