magp
(marco Pereira)
August 5, 2020, 1:27pm
1
Hi !
I am new here and i have been trying to make some API calls to test it, using curl. I am following the examples provided here https://wiki.openmrs.org/pages/viewpage.action?pageId=52625683 , in particular this one:
echo '{
“preferredIdentifier”:{
"identifier":"abc123ez",
"identifierType":"8d79403a-c2cc-11de-8d13-0010c6dffd0f",
"location":"Unknown Location"},
“preferredName”:{
"givenName":"Magpie",
"familyName":"Programmer"},
“birthdate”:“1978-01-15”,
“gender”:“M”
}’ | curl -i -u admin:Admin123 -H “Content-type: application/json” -X POST -d @- https://demo.openmrs.org/openmrs/ws/rest/v1/patient
However I always get 404 not found. Is this the expected behaviour?
rishabh997
(Rishabh Agarwal)
August 5, 2020, 1:51pm
2
ayesh
(Ayeshmantha Perera)
August 5, 2020, 1:56pm
3
Check out the swagger
https://qa-refapp.openmrs.org/openmrs/module/webservices/rest/apiDocs.htm
If you’re trying to learn first play with the get endpoint try to retrieve a patient and see the attributes then work on the post-call
magp
(marco Pereira)
August 5, 2020, 2:06pm
4
Thank you both for the prompt reply!
I will follow your advice, thank you again.
EDIT:
I just tried out your page where I was able to generate a very simple command (copy pasted from there):
curl -X GET “https://qa-refapp.openmrs.org/openmrs/ws/rest/v1/patient ” -H “accept:
application/json”
However when I run it in my terminal I get a 500 - Internal error.
Is it working for you?
burke
(Burke Mamlin)
August 5, 2020, 8:19pm
5
Hopefully you find the documentation at rest.openmrs.org helpful and, if not, you can help us improve it.
@rainbow & @ayesh , @magp is your customer. If they didn’t find your API docs easily/first, why not? If the documentation isn’t answering their questions, what’s missing?
1 Like