I am getting back into programming after being gone for 20 years. A lot has changed! lol...
I have a NodeJS server setup on Heroku for my mobile app. I am trying to add an event on my server that will add new user info to Pipedrive.com using their API.
But I'm still trying to get a grip on what's happening in their API code. This is my first time to implement an API by myself.
Here is the page I am trying to translate:
I don't need the organization. Just the person and the deal.
In my create_person function, I found this php:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $person);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
My questions are:
What is curl_init and curl_setopt?
Do I need them in my Nodejs script file for this?
Thanks for your patience. Learning a ton here!!!
curl is a PHP library that handles making requests.
In this case
curl_init() is initialising a new request and
curl_setopt is setting certain options.
You'll want to replace
curl with an equivalent library for NodeJS. The request module is pretty good for this, although there's plenty of other options too.