All Categories
Overview
This endpoint retrieves a list of categories. It supports pagination, allowing clients to fetch categories in batches. It's suitable for applications that require detailed information about drug categories, particularly in pharmaceutical or healthcare contexts.
Authentication
To access the endpoint, use the Authorization: Bearer BRITE_API_KEY
header. Replace BRITE_API_KEY
with your actual API key.
HTTP Request
GET https://www.britelink.io/api/v1/categories
Query Parameters
Parameter | Description | Required | Type |
---|---|---|---|
c | Comma-separated list of category names to filter by. | No | String |
r | Set to true to include related drugs in the response. | No | Boolean |
cursor | Cursor for pagination. Use the nextCursor value from a previous response to fetch the next batch of results. | No | String |
Pagination
The endpoint returns a maximum of 25 categories per request. To navigate through more categories, use the cursor
parameter with the nextCursor
value provided in the response.
Responses
- HTTP 200: Successful response with categories.
- HTTP 404: No categories found for the given filters.
- HTTP 500: Server error.
Sample cURL Request
curl -X GET 'https://www.britelink.io/api/v1/categories?c=Antiviral&cursor=YourCursor' \
-H 'Authorization: Bearer BRITE_API_KEY'
Sample Response
{
"categories": [
{
"id": "clqjkjarq000249kh4w254b4l",
"name": "Antiviral Medications",
"meshId": "MESH67890",
"meshTreeNumbers": "J01CR3",
"atcCode": "J05AB",
"atcLevel": 3,
"categorizationKind": "Medical",
"synonyms": "Anti-Virals",
"description": "Medications for viral infections"
}
],
"nextCursor": null
}
Sample Use Case with Axios
This endpoint is ideal for developers building healthcare applications that need to categorize medications or provide detailed information on different categories of drugs.
import axios from "axios";
const fetchCategories = async (cursor) => {
try {
const response = await axios.get(
"https://www.britelink.io/api/v1/categories",
{
headers: {
Authorization: `Bearer ${apiKey}`,
},
params: {
c: "Antiviral",
cursor: cursor,
},
}
);
console.log(response.data);
} catch (error) {
console.error(error);
}
};
fetchCategories(); // Call this function with the nextCursor value to paginate
Notes
- Replace
BRITE_API_KEY
with your actual API key for authentication. - The JavaScript example uses Axios for making HTTP requests, a popular choice in many web and Node.js applications.