Making https calls from user defined UDF

Hi, Has any one tried making any external api calls over https. from UDF functions defined in C++. We tried but it gets into some library issue. Will share the logs in short while. But any external call to http works. Has any one tried this and it worked ?

@kapilsaini It’s been discussed a couple times in the community, but I think you’re the first to try the implementation. Can you share relevant information? Logs. UDF snippet. What issues pop up?

At the first glance, it looks more like C++ issue, not TigerGraph issue.

HTTPS requests involve certificates and other stuff to be configured…

For example, take a look at this one:

Hello @Jon_Herke , I am following up on @kapilsaini’s question to share the logs. When the c++ function is run by itself it works with curl. There is no issues with the UDF function. However, when we call the UDF function in tg server, curl doesn’t work as part of the c++ library in tg server because we get the CURLE_OK as 1 which is refers to the curse_unsupported_protocol(1). The link I use for test is “” and CURLE_OK was 1. Is there any specific configuration we need to enable to resolve this?

Below is the UDF snippet:

inline string test_curl(string url_s)
{ string retStatus;

    CURL *curl;
    CURLcode res;
    string readBuffer;

    curl = curl_easy_init();
    std::cout<<"+++++++++++Hello let's test++++++++"<<std::endl;
    if (curl)
      curl_easy_setopt(curl, CURLOPT_URL,url_s.c_str());
      curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
      curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
      curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
      curl_easy_setopt(curl, CURLOPT_TIMEOUT, 20L);

      res = curl_easy_perform(curl);
      std::cout<<res<<" ++++++++++++++++++++++++Error code"<<std::endl;
      if(res != CURLE_OK)
        std::cout<< " Curl Failed " << curl_easy_strerror(res) << " URL Used "<< url_s << std::endl;

std::cout<<"+++++++++++++++Check the error status from curl"<<std::endl;
return retStatus;