Get Food Interaction Data by ID
Overview
The Food Interaction by ID endpoint enables users to fetch detailed information about a specific food interaction based on its unique identifier (ID). This endpoint provides access to essential details of the food interaction, including advice, associated drug ID, and the name of the drug it belongs to.
Endpoint
GET https://www.britelink.io/api/v1/food_interactions/{foodInteractionId}
Authorization Header
To access the endpoint, include an authorization header with your request:
Header | Value |
---|---|
Authorization | Bearer YOUR_API_KEY |
Replace YOUR_API_KEY
with the API key you receive upon registration or from your API management dashboard.
Making a Request
Example Request using cURL
curl -X GET "https://www.britelink.io/api/v1/food_interactions/{foodInteractionId}" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Request using JavaScript
const apiKey = "YOUR_API_KEY"; // Replace with your API key
const apiUrl =
"https://www.britelink.io/api/v1/food_interactions/{foodInteractionId}";
fetch(apiUrl, {
method: "GET",
headers: {
Authorization: `Bearer ${apiKey}`,
},
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
Request Parameters
This endpoint does not accept query parameters. The food interaction ID is extracted from the URL path.
Responses
- HTTP 200: Success, returns detailed information about the food interaction.
- HTTP 404: Food interaction not found.
- HTTP 500: Internal server error.
Response Format
The response is structured as JSON and includes the following information:
id
: Unique identifier of the food interaction.advice
: Advice or guidance related to the food interaction.drugId
: Unique identifier of the drug associated with the food interaction.drugName
: Name of the drug associated with the food interaction.
Example Response
{
"id": "clt89kbzr0002m7yxc49ng8gc",
"advice": "Avoid consumption of grapefruit while taking this medication.",
"drugId": "clslvdmpp000y1gmwz3e7tckd",
"drugName": "Paracetamol"
}
Use Cases
- Medical Counseling: Provide patients with specific advice regarding dietary restrictions based on drug-food interactions.
- Drug Interaction Management: Support healthcare professionals in managing drug therapy by considering potential food interactions.
- Patient Education: Educate patients about the impact of certain foods on medication effectiveness and safety.
Best Practices
- Verify the correctness of the provided food interaction ID to ensure retrieval of accurate information.
- Handle potential errors such as 404 (Food interaction not found) gracefully in your application logic.