Fetch Drugs in a Given Category
Endpoint Overview
This endpoint retrieves a list of drugs associated with a specific category ID in the database. It is designed to help users access detailed information about drugs under a particular medication category.
HTTP Request
GET https://www.britelink.ios/api/v1/categories/{categoryId}/drugs
URL Parameters
Parameter | Required | Description |
---|---|---|
categoryId | Yes | The unique identifier of the category. |
Headers
Header | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer YOUR_API_KEY (if authentication is required) |
Responses
Success Response
Code: 200 OK
Content example for a successful response:
[
{
"id": "drugId123",
"tradeName": "DrugName",
"genericName": "GenericDrugName",
"categoryId": "categoryId123"
// Additional drug details...
}
// More drugs...
]
Error Responses
Code: 400 Bad Request
Content: {"error": "Category ID is required in the request URL"}
Code: 404 Not Found
Content: {"error": "No drugs found in the specified category"}
Code: 500 Internal Server Error
Content: {"error": "An error occurred while fetching drugs"}
Example Request
Fetching drugs in the 'Pain Relievers' category:
GET /api/v1/categories/clqjkjarq000049khgvkwz6gf/drugs
Host: www.britelink.io
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
Notes
- Ensure your API key (if required) is included in the header for authentication.
- The endpoint will return an array of drug objects, each containing detailed information about the drug.
- The structure of the drug object in the response will depend on the database schema and the selected fields in the query.