I am from Indonesia, and newbie in dataverse. I try to call API dataverse from PHP to import dataset JSON into dataverse but i got messege
{"status":"ERROR","code":404,"message":"'/api/v1/dataverses/puslitekonomi-lipi/:import' endpoint does not exist on this server. Please check your code for typos, or consult our API guide at
http://guides.dataverse.org."}
$url = '
https://xxx/api/dataverses/xxx/:import?pid=xxx&release=no&key=xxx';
//create a new cURL resource
$ch = curl_init($url);
//echo $url;
//HTTP username.
$username = 'xxx';
//HTTP password.
$password = 'xxx';
//setup request to send json via POST
$payload = json_encode($array_dataset);
//attach encoded JSON string to the POST fields
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
//set the content type to application/json
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type:application/json',
'Authorization: Basic '. base64_encode("$username:$password")));
//return response instead of outputting
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//execute the POST request
$result = curl_exec($ch);
echo $result;
//echo 'Request Error:' . curl_error($ch);
//close cURL resource
curl_close($ch);