Hello.
I am trying to access openEMR from API call.
First, by using postman. I found a good demo server that I can access from the browser:
http://eight.openemr.io/a/openemr
When using postman, I am providing this in the request body:
{
“grant_type”: “password”,
“username”: “admin”,
“password”: “pass”,
“scope”: “default”
}
But still I get 401 Unauthorized as response.
The goal is to create a .NET application that can access openEMR, this is my simple code:
string URL = "http://eight.openemr.io/a/openemr/apis/api/auth";
string URL2 = "http://eight.openemr.io/a/openemr/apis/api/patients";
var client = new FhirClient(URL);
Patient myPat = new Patient();
myPat.Identifier.Add(new Identifier("http://www.nhsdev.net/psn", "4568532"));
myPat.Active = true;
HumanName patName = new HumanName();
patName.GivenElement.Add(new FhirString("Vincent"));
patName.Use = HumanName.NameUse.Official;
myPat.Name.Add(patName);
myPat.Gender = AdministrativeGender.Male;
myPat.BirthDate = "1989-01-21";
myPat.ManagingOrganization = new ResourceReference() { Reference = "Organization/NHSDEVORG" };
client.Create<Patient>(myPat);
I get an exception:
“Operation was unsuccessful because of a client error (Unauthorized). Body has no content.”
How do I provide a body in the request?
Thanks for any help!