I wrote code to adding providers and it is work
<?php
$username = “admin”; $password = “Admin123”;
$lines = file(‘C:\Users\User\Desktop\providers.csv’);
foreach ($lines as $line) {
$params = explode(“;”, $line);
$test2 = array( array(‘givenName’=>$params[0], ‘familyName’=>$params[1])
);
$test = array( ‘names’=> $test2, ‘gender’ => $params[2] ‘’ ); $provider = array( ‘identifier’=>‘doctor’, ‘person’=>$test ); // echo json_encode($provider);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://blablabla/openmrs/ws/rest/v1/provider'); curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, “$username:$password”); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, array( ‘Content-Type: application/json’ )); curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($provider)); curl_setopt($curl, CURLOPT_USERAGENT, ‘Mozilla/5.0’);
$res = curl_exec($curl); echo $res; }
?>
My problem is that I want to add another type of attribute (locationID) for the provider and associate them. But in the API documentation here absent LocationID for providers. As I understand, I should create a new class for location and change the database. Please tell me which modules I should change and in which places or if there are alternative solutions.