Updates a patient's phone number and/or primary address. Only patients in your organization can be updated; staff accounts and other organizations' patients are not reachable. Email changes are not supported through this endpoint. Requires an API key with the write scope.
Ejemplos de código
Node.js
const fetch = require('node-fetch');
async function llamarApi() {
const claveApi = 'YOUR_API_KEY';
const url = `https://account.lunahealth.app/api/patients/{id}`;
const requestBody = {
// Agregue sus datos del cuerpo de la solicitud aquí
};
try {
const response = await fetch(url, {
method: 'PATCH',
headers: {
'Authorization': `Bearer ${claveApi}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(requestBody)
});
if (!response.ok) {
throw new Error(`API error: ${response.status}`);
}
const data = await response.json();
console.log(data);
return data;
} catch (error) {
console.error('Error al llamar a la API:', error);
throw error;
}
}
llamarApi();
Python
import requests
def llamarApi():
claveApi = 'YOUR_API_KEY'
url = 'https://account.lunahealth.app/api/patients/{id}'
headers = {
'Authorization': f'Bearer {claveApi}',
'Content-Type': 'application/json'
}
params = {
}
# Agregue sus datos del cuerpo de la solicitud aquí
request_body = {}
try:
response = requests.patch(
url,
headers=headers,
params=params,
json=request_body
)
response.raise_for_status()
data = response.json()
print(data)
return data
except requests.exceptions.RequestException as e:
print(f'Error al llamar a la API: {e}')
raise
llamarApi()