[OpenSIPS-Users] CURL library with respect to REST_API calls

Ramachandran, Agalya (Contractor) Agalya_Ramachandran at comcast.com
Wed Jun 22 19:19:00 CEST 2016


Hi team,

Any one has any clue on the below topic?

Regards,
Agalya

From: Ramachandran, Agalya (Contractor)
Sent: Monday, June 20, 2016 1:45 PM
To: OpenSIPS users mailling list <users at lists.opensips.org>
Subject: CURL library with respect to REST_API calls

Hi team,

I have a question regarding curl library behavior with respect to curl_easy_perform API call.
Here is the snippet of the code that am using in "rest_put" API call in rest_methods.c file

  w_curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_func);
 w_curl_easy_setopt(handle, CURLOPT_WRITEDATA, &res_body);

When curl_easy_perform API call is success, I could able to retrieve the result body from the res_body.
But in the case of API call failure am not getting any details of the message. But getting only the http response code.
Is there a way to get the message details as well in the case where curl_easy_perform API fails?

LM_INFO(" Actual result body is %s\n", res_body.s);
When I print this, in the case of success, am getting a http response message in detail.
But in case of failure, the call back function write_func is not at all called. Why it is so?

Please guide me if there is a way to the message details in case of failure too.

Regards,
Agalya

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160622/bf4a055a/attachment-0001.htm>


More information about the Users mailing list