jramirez
(Jeniree Ramirez)
October 6, 2020, 12:22pm
1
It strikes me that the documentation for the rest of the api does not include the email as user data? is this an error or is it missing?
if I add it I get the following error Some properties are not allowed to be set: email
What should I do to save the user’s email through the rest of the user’s api?
dkayiwa
(Daniel Kayiwa)
October 6, 2020, 1:58pm
2
Can you share the REST url and data that you are sending to reproduce this?
jramirez
(Jeniree Ramirez)
October 6, 2020, 2:26pm
3
$user_data=’{“username":“test”,“password”:“Admin123”,“email”:"test@gmail.com ”,“person”:{“names”:[{“givenName”:“test”,“familyName”:“testFamily”}],“gender”:“F”},“roles”:[“d52ecefe-6153-493e-a064-74881bb900cf”]}’;
$user_curL = curl_init(‘http://localhost:8080/openmrs/ws/rest/v1/user ’);
curl_setopt($user_curL, CURLOPT_HTTPAUTH,CURLAUTH_BASIC);
curl_setopt($user_curL, CURLOPT_USERPWD,“admin:Admin123”);
curl_setopt($user_curL, CURLOPT_RETURNTRANSFER,true);
curl_setopt($user_curL, CURLOPT_HTTPHEADER, array(‘Content-Type:application/json’));
curl_setopt($user_curL, CURLOPT_POST,1);
curl_setopt($user_curL, CURLOPT_POSTFIELDS,$user_data);
$output = curl_exec($user_curL);
$response = json_decode($output);
$status = curl_getinfo($user_curL,CURLINFO_HTTP_CODE);
I need to save the email as the user’s field
dkayiwa
(Daniel Kayiwa)
October 6, 2020, 3:19pm
4
Which versions of the OpenMRS platform and webservices rest module are you running?
dkayiwa
(Daniel Kayiwa)
October 6, 2020, 3:39pm
5
The email field was added in platform 2.2.0 via this ticket . It is not yet added to the webservices rest module. Feel free to create a ticket for it under the webservices rest JIRA project.
jramirez
(Jeniree Ramirez)
October 6, 2020, 5:01pm
6
I don’t have permission to view the ticket
dkayiwa
(Daniel Kayiwa)
October 6, 2020, 5:24pm
7