Content Types
Response Body
JSON Format
To retrieve data from the BriteAPI V1, the response format defaults to JSON. Currently, JSON is the only available format. To specify JSON format explicitly, you have the following options:
Using the Accept Header
curl -L 'https://www.britelink.io/api/v1/drugs' \
-H 'Authorization: Bearer BRITE_API_KEY' -H 'Accept: application/json'
Using the .json File Extension
You can also indicate your preference for JSON encoding by appending ".json" to the endpoint:
curl -L 'https://www.britelink.io/api/v1/drugs.json' \
-H 'Authorization: Bearer BRITE_API_KEY'
The response will be in JSON format by default.
Request Headers
Header Descriptions
- Accept: This header specifies the requested MIME type of the response. When used, it helps ensure that the response is in the desired format.
Response Headers
Header Descriptions
- Content-Type: This header indicates the MIME type of the response body. In the BriteAPI V1 , the Content-Type header will typically be set to indicate that the response is in JSON format.
Request Body
Sending Data via POST Request
For API calls that use a POST request to send data to the API (e.g., when finding drug-drug interactions with mixed input), you must set the appropriate Content-Type header.
Example POST Request
curl -L -X POST "https://www.britelink.io/api/v1/drugs/ddi" \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer BRITE_API_KEY' \
-H "Cache-Control: no-cache" -d '{
"ndc": ["0143-9503", "0056-0173"],
"briteId": ["brite_0x123", "brite_0x456"],
}'
In this example, we set the Content-Type header to "application/json" to indicate that the request body contains JSON-encoded data.
Request Headers
Header Descriptions
- Content-Type: This header specifies the MIME type of the request body, indicating that it contains JSON data.