Create an open REST API in 2 minutes with Bridge [no code]
Bridge is a free tool to create REST APIs for your mocks or Open Data projects.
Quick tutorial to go from an Excel or CSV file to an open REST API in JSON in just 2 minutes with Bridge.
Which kind of API can we create ?
Bridge is a free tool that creates and hosts simple APIs. If you need API that calculates the distance from your current position to the moon, it’s definitely not the right tool. But if you just need a standard API that returns a static set of data (GET requests only), this tutorial is made for you.
We don’t need to install and configure any kind of server (and neither pay for it). Bridge takes care of the dirty work. Basically, we just have to upload the data.
Create a new API
Ok, let’s click on “sign up” and create an account (one step only). Once in the dashboard click on “create a new API”.
We will pretend that we are a museum that wants to list its works in this example.
Create easily an API for your organisation.
The API name should be general, like the name of your organisation/project/company… (the museum’s name in our case). You will be able to add spreadsheets later on.
Add a spreadsheet to our API
Let’s continue and click on “add a new spreadsheet”. We are going to upload our Excel or CSV file with the data we want to open.
We want to import this spreadsheet with a list of works. Notice the “field with no values”, the field is empty for all our works but we could have a 4th work with a value in this field.
In our example, we will import a simple spreadsheet with a list of the museum’s works. The spreadsheet name will be “works”.
Bravo
That’s it ! The Excel / CSV spreadsheet has been imported in the API and it is now open to the public. If you want to update the data later, you would just need to upload un updated Excel file.
Back on the API page of “The Peach Museum”, we will click on “see documentation”. If you are a developper, we will instantanelly have 2 thoughts :
- Cool, the doc has been automatically generated !
- Wow, it’s really nice.
If you are not a developper, just know that this documentation contains all the elements needed for others to connect to your new API.
Your API documentation is available ! Check the example responses at right, one for each endpoint.
It was fast, right ? Let’s test what we created.
Test our new REST API
The documentation shows us 2 RESTful endpoints :
- GET /works for the list of works
- GET /works/{id} to get a specific work
Let’s copy-paste the full URL to see what happens. I am using Postman but you can do it in the web browser you are using right now. As you can see, wee receive clean JSON with our data.
We receive clean JSON from the API. The “field with no values” is still here because it was in our Excel spreadsheet.
We can filter those results if we want, using one or several parameters in our HTTP request. Bridge automatically extracts parameters from the uploaded spreadsheets. Just try it yourself :
Retreive a single item
There is no “id” property in our data. If it was the case, we could retreive a defined item by its id.
If there is no “id” column like in our case, Bridge will consider each item’s position in the array as it’s id :1 to get the first item, 2 for the second etc. Technically it’s an “index + 1” :)
Conclusion
We just created an open REST API incredibly fast.
API URLs are RESTful, on “https” and deliver clean JSON based on your Excel or CSV file.