Short Notes
April 2nd, 2024

Using Bruno - the API client

I started using Bruno this weekend, and I enjoyed it very much.

The biggest advantage for me is having all the collections stored in text files on my file system.

See

Source: https://www.usebruno.com/compare/bruno-vs-postman
Source: https://www.usebruno.com/compare/bruno-vs-postman

I  store them in a Rails app's/docs/requests folder. Works very well!

Here is an example of what I defined in the project that I use to manage citations for Short Ruby Newsletter.

This is how I defined a collection. Bruno uses their own markup language called Bru, which is similar to JSON in some ways. For instance, it uses key-value pairs to store data, just like JSON.

Diff showing how I defined the collection for Mastodon bookmarks
Diff showing how I defined the collection for Mastodon bookmarks


I wanted the maston_access_token to be loaded from .env variables. So I defined this for Bruno (yes the file extension if .bru :) )

Defining the access token variable
Defining the access token variable

I created a new environment file at docs/REST/.env that I wanted to not add to Git.

And because Git allows you to define .gitginore files in subfolders, I added a .gitignore file in ./docs to ignore the .env file.

I also added .env.sample to remind myself what do I need to define.

Defining .gitignore and .env.sample
Defining .gitignore and .env.sample