So I've been trying to make a basic request to the local server to get demo patient 11 in the database. However, I seem to be having trouble with making basic contact with the API. I've attached my firewall settings as well as my python script (Ran this from wsl) in this post. Could anyone please tell me what I might be doing wrong? I also made sure to launch openDental itself as admin.
If I try to access the API using a simple method, such as through chrome, such as with
Code: Select all
http://localhost:30223/api/v1/patients/11/
Code: Select all
import requests
# Replace these values with your actual data
api_base_url = "http://localhost:30223/api/v1"
endpoint = "/patients/11/"
developer_key = "NFF6i0KrXrxDkZHt"
customer_key = "VzkmZEaUWOjnQX2z" #Have tried this with my own keys
# Combine developer key and customer key for Authorization header
authorization_header = f"ODFHIR {developer_key}/{customer_key}"
# Define headers
headers = {
"Content-Type": "application/json",
"Authorization": authorization_header,
}
# Define the full URL for the API call
url = api_base_url + endpoint
# Make a GET request
response = requests.get(url, headers=headers)
# Check the response status code
if response.status_code == 200:
# API call was successful, process the response
data = response.json()
print("API Response:", data)
else:
# Print an error message if the API call was not successful
print(f"Error: {response.status_code} - {response.text}")