Hi Sherwin and Daniel,
Sorry for my delayed response on this - I have been very ill. Follow these steps to get the REST API up and running so we can continue with some of the TODO items.
- Install Ubuntu on your computer or in a VirtualBox via https://itsfoss.com/install-linux-in-virtualbox/
- Install Docker:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
sudo apt update -y
sudo apt install -y docker-ce
sudo curl -L https://github.com/docker/compose/releases/download/1.18.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo groupadd docker
sudo usermod -aG docker $USER
- Setup your SSH key by following https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/
- run
git clone git@github.com:{your up to date fork}/openemr.git # must be your updated openemr fork
- run
cd openemr
- run
docker-compose up
- Open up Chrome and visit
http://localhost:8300/interface/login/login.php?site=default
- Login with
admin
/pass
- Go to Administration > Globals > Connectors
- Check Enable OpenEMR REST API and click Save
- Open up a terminal and execute the following:
curl -X POST -H 'Content-Type: application/json' 'http://localhost:8300/apis/api/auth' \
-d '{
"grant_type":"password",
"username": "admin",
"password": "pass",
"scope":"default"
}'
- Copy the
access_token
part of the response to your clipboard (for example):
0087041b68035831e2d062d3f65081e76f656d7264656661756c74
- Execute the following command (with the correct token, e.x.:
0087041b6803...
):
curl -X POST 'http://localhost:8300/apis/api/patient' -d \
'{
"title": "Mr",
"fname": "Foo",
"mname": "",
"lname": "Bar",
"street": "456 Tree Lane",
"postal_code": "08642",
"city": "FooTown",
"state": "FL",
"country_code": "US",
"phone_contact": "123-456-7890",
"dob": "1992-02-02",
"sex": "Male",
"race": "",
"ethnicity": ""
}' \
-H 'Authorization: Bearer 0087041b68035831e2d062d3f65081e76f656d7264656661756c74'
- Assuming success, list all patients with the following command:
curl -X GET 'http://localhost:8300/apis/api/patient' -H 'Authorization: Bearer 0087041b68035831e2d062d3f65081e76f656d7264656661756c74'
-
If correct, "Mr. Foo Bar" patient will be shown.
-
Reply-all to this email thread once you have reached this point and then we'll talk about how to change the code as well as open tasks.