BConnect Data API
This page provides information on how to use the BConnect Data API
Brighton Science BConnect Data API Overview
The BConnect Data API offers direct access to BConnect’s data, supporting a range of systems integration applications, including Change Data Capture (CDC) and reporting use cases. By leveraging the HTTP REST API, you can retrieve measurements and metadata efficiently and securely.
Change Data Capture (CDC)
The Change Data Capture (CDC) process allows external systems to track and load all data changes that occur within BConnect. Using this method, a request is sent to the Data API at regular intervals to fetch data modifications that have occurred since the last request. This enables seamless synchronization of data with external systems.
The Data API supports queries with a specified time range (start and end) to capture entities that have been modified within that period. Note that the same entity may be returned multiple times across different time ranges if updates have occurred repeatedly.
Reporting
The BConnect Data API also facilitates reporting by providing access to measurements and their associated contexts. You can query by experiment ID or process monitors, for instance, to generate detailed reports. Time-based filtering is available via start and end timestamps, allowing you to narrow down results within specific date ranges.
Using the API
Authentication
Access to the BConnect Data API requires authentication via OAuth. API key credentials can be generated from the Administration tab in BConnect.
To authenticate, an OAuth bearer token is required, which is obtained by making an HTTP POST
request to the BConnect OAuth provider at:
https://api.brighton-science.com/oauth/token
The API request body must include your client credentials as shown below:
{
"client_id": "<Client Id>",
"client_secret": "<Client Secret>"
}
curl -X POST -H "Content-Type: application/json" -d "@auth-request.json" "[https://api.brighton-science.com/oauth/token"](https://api.brighton-science.com/oauth/token%22 "https://api.brighton-science.com/oauth/token%22")
Example Response
Upon success, the request will return a JSON object that includes your Bearer Token:
{"access_token":"<Bearer Token>","scope":"read:api-measurements read:api-experiments read:api-projects read:api-workflows read:api-alerts read:api-facilities read:api-processes","expires_in":86400,"token_type":"Bearer"}
This bearer token will be required in the header of all subsequent API requests.
Making API Requests
Once you have your bearer token, you can access the Data API. For example, to retrieve experiment data within a certain time frame, execute the following request:
curl -X GET -H "Authorization: Bearer <Bearer Token>" "[https://api.brighton-science.com/api/v1/experiments?start=2020-01-01T09%3A53%3A00.000Z&end=2024-01-01T09%3A53%3A00.000Z"](https://api.brighton-science.com/api/v1/experiments?start=2020-01-01T09%3A53%3A00.000Z&end=2024-01-01T09%3A53%3A00.000Z%22 "https://api.brighton-science.com/api/v1/experiments?start=2020-01-01T09%3A53%3A00.000Z&end=2024-01-01T09%3A53%3A00.000Z%22")
Data API conventions
Formats
The data formats are throughout the API for request and response values.
Name | Example | Description |
---|---|---|
Number | 42 3.1416 |
Any numeric value. |
Integer | 42 |
A whole number. |
Double | 3.14159265 |
A floating point number. |
UUID | cccc10be-225b-423c-aaaa-08d115b67fff |
A global unique identifier as string. |
Timestamp | 2022-04-18T09:53:00.000Z |
ISO 8601 timestamp with date, time and timezone. |
String | abcd |
Any plain string value. |
Boolean | true or false |
A boolean value. |
Mime-Type | application/json |
A content mime-type |
Enum | Enum <experiment\|freeform> |
A value out of a fixed list of possible values values. The possible values are specified in between <> , and separated by \| . |