Entrypoint and profile for a single user on the BAQ network.
{
"entity": "maggie.baq.run",
"previous_entities": [],
"profile": {
"name": "Maggie Blum"
},
"servers": [...]
}
EntityRecordA public Record that is returned during the discovery process. It contains a user’s entity, public profile, and server endpoints.
entity Entity
previous_entities Entity[]
profile EntityRecordProfile
servers EntityRecordServer[]
Servers to contact to interact with this user.
Should contain at least one server.
Items within should be presented in order of preference.
There can be only one Entity record for a given user.
The Entity record is the entrypoint to a user’s BAQ data. When a user moves to a new server, the Entity record is updated and propagated on the network.
The Entity record is created by the user’s server during initial sign-up.
EntityRecordProfileavatar BlobLink optional
Public avatar for this user.
Maximum size of 256kB.
name string optional
Display name for this user.
Maximum length of 40 unicode code points.
bio string optional
Short introduction for this user.
Maximum length of 160 unicode code points.
website URI optional
location string optional
EntityRecordServerversion string
Version of the API supported by this server.
Currently, all servers are version 1.0.0.
endpoints EntityRecordServerEndpoints
EntityRecordServerEndpointsThe various HTTP endpoints to interact with the BAQ server.
auth URI
Authentication flow entrypoint.
URL template variables:
{record_id}: ID of the application record to authenticate.new_record URI
records URI
record URI
Fetch or update a single record.
URL template variables:
{entity}: Entity of the record’s author.
{record_id}: ID of the record.
record_versions URI
List record versions in chronological order.
URL template variables:
{entity}: Entity of the record’s author.
{record_id}: ID of the record.
record_version URI
Fetch a single record version.
URL template variables:
{entity}: Entity of the record’s author.
{record_id}: ID of the record.
{version_hash}: Hash of the version.
new_blob URI
record_blob URI
Fetch a single blob from a record.
URL template variables:
{entity}: Entity of the record’s author.
{record_id}: ID of the record.
{blob_hash}: Hash of the blob.
{file_name}: Name of the file as specified in the record.
record_version_blob URI
Fetch a single blob from a record version.
URL template variables:
{entity}: Entity of the record’s author.
{record_id}: ID of the record.
{version_hash}: Hash of the version.
{blob_hash}: Hash of the blob.
{file_name}: Name of the file as specified in the record.
events URI
new_notification URI
server_info URI
The endpoint format can vary from one server to another. URI Template variables are used to build to actual URL to query. Each of these are valid values for the record endpoint:
https://baq.run/api/julie/records/{entity}/{record_id}
https://julie.baqhost.org/records?entity={entity}&record={record_id}
https://freebaq.org/users/julie/{entity}/record?id={record_id}
This is what the full content of an Entity record might look like.
{
"entity": "julie.baq.run",
"previous_entities": [],
"profile": {
"avatar": {
"hash": "401599ca6e41cef5625b48ba38f1e3cc4d68fecf0b45109bcbb1e4f7ba22c5e4",
"type": "image/jpeg",
"name": "avatar.jpg"
},
"name": "Julie"
},
"servers": [
{
"version": "1.0.0",
"preference": 0,
"endpoints": {
"auth": "https://baq.run/julie/auth/{record_id}",
"records": "https://baq.run/api/julie/records",
"record": "https://baq.run/api/julie/records/{entity}/{record_id}",
"record_versions": "https://baq.run/api/julie/records/{entity}/{record_id}/versions",
"record_version": "https://baq.run/api/julie/records/{entity}/{record_id}/versions/{version_hash}",
"new_record": "https://baq.run/api/julie/records",
"record_blob": "https://baq.run/api/julie/records/{entity}/{record_id}/blobs/{blob_hash}/{file_name}",
"record_version_blob": "https://baq.run/api/julie/records/{entity}/{record_id}/versions/{version_hash}/blobs/{blob_hash}/{file_name}",
"new_blob": "https://baq.run/api/julie/blobs",
"events": "https://baq.run/api/julie/events",
"new_notification": "https://baq.run/api/julie/notifications",
"server_info": "https://baq.run/api/julie/server"
}
}
]
}
To fetch a record, we use the endpoints map to build the URL to query. Here’s an example of how this could be done (the JavaScript SDK handles this automatically).
function fetchRecord(entityRecord, entity, recordId) {
const server = entityRecord.content.servers[0];
const endpoint = server.endpoints.record;
const url = endpoint
.replaceAll("{entity}", entity)
.replaceAll("{record_id}", recordId);
return fetch(url);
}