I am a complete beginner when it comes to APIs. I would like to access the API of https://foundico.com, I even received a public and a private key, however, the documentation is quite sparse and only provides the code in PHP (can be found here https://foundico.com/developers/)
The code is as follows:
$privateKey = 'privateKey';
$publicKey = 'publicKey';
$parameters = array('status' => 'upcoming');
$postData = json_encode($parameters);
$accessKey = base64_encode(hash_hmac('sha256', $postData, $privateKey, true));
$ch = curl_init('https://foundico.com/api/v1/icos/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'X-Foundico-Public-Key: '.$publicKey,
'X-Foundico-Access-Key: '.$accessKey
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
I would like to access the API in R so that I can directly use the data in my code. How would I translate this into R?