Flanny.app
Apps Blog Me

Bell

A REST scripting language

January 2024

I’ve always felt that Postman was too bogged down with menus. While it’s a powerful tool, it often feels like overkill for simple API testing. Collaboratively, Postman doesn’t work as well as GitHub because its internal storage formats are opaque and difficult to “diff.” Plus, Postman for teams is quite expensive for a small developer group.

As a programmer, nothing is more clear than a simple script. It’s just text that does what it says it will do. Nothing is buried in sub-menus, hidden tabs, or a proprietary UI. If you want to see how an endpoint is called, you just read the code.

So I came up with Bell, a domain-specific language (DSL) designed for making RESTful API calls as simply as possible.

A simple Bell file might look like this:

# status.GET.bell
id = 1234
url test.com/status/{id}
GET

A more complicated one involving auth tokens and user input might look like this:

# status.POST.bell

domain "test.com"
path "/login"

body
{
  username: "testuser",
  password: "testpass"
}

POST

token = response.body.token

path "/post"

headers
{
  Authorization: `Bearer: ${token}`
} 

body
{
  message: input('Write a message')
}

POST

log response.body.status

The core idea behind Bell is that your API documentation is your testing script. Because it’s just text, it can be committed to Git alongside your source code. When a teammate updates an API endpoint, they can update the .bell script in the same pull request, and you can see exactly what changed in the request structure.

With the help of some basic syntax highlighting and VSCode plugins, Bell becomes a viable alternative to heavyweight GUI tools. It prioritizes the “developer experience” by keeping the focus on the request data and response handling, rather than the interface surrounding it. I built the initial parser in TypeScript, ensuring that it’s fast and can be easily integrated into CI/CD pipelines to verify API health on every deploy.