How To Use The BBJ API

a guide for querying BBJ on tilde.town

dozens

2023-08-07

Hello

Yes hi this is a very short note on how to query BBJ on tilde.town.

Use Case

My use case is that there is a very long BBJ thread that I wanted to export, clean up, store locally, and refer to later.

Read The Docs

The API docs are here:

https://github.com/bbj-dev/bbj/blob/master/docs/docs/api_overview.md

and it might be useful to know the error codes as well:

https://github.com/bbj-dev/bbj/blob/master/docs/docs/errors.md

Get All Thread Ids

First, you need to call thread_index to find the id of the thread you’re looking for:

curl 127.0.0.1:7099/api/thread_index

That should give you a big JSON blob that you can jq or search in or whatever. What I did was just open it up in vim and search for the thread title.

Get Thread

Once you have your thread id, you can get the thread contents:

curl -X POST \
-H "Content-Type: application/json" \
-d '{"thread_id:"your-thread-id-here"}' \
127.0.0.1:7099/api/thread_load

And there you have it, a big blob of JSON with the thread contents. Do with it as your little heart desires.