How to Use the Softr Rest API (Example with Coda)
When building apps or other digital systems, you may want to automate workflows to improve data accuracy, reduce manual work, and make the system more scalable and error-proof. APIs (application programming interfaces) allow you to create automations by programmatically reading and writing data within applications.
In the no-code app building space, Softr provides a public API that simplifies user syncing, payment processing, and third-party data integration. This extends beyond Softr's built-in sync features like pre-defined data sources and user syncing. In this post I am exploring the REST API in Softr, how it works, and practical implementation details.
How to use the Softr REST API
Softr is a frontend-only tool. It lets you build what users see, while storing your data in separate tools like Airtable, Google Sheets, or Notion.
You can connect many data sources to your Softr app. This means you can combine data from different tools - like projects from Airtable and invoices from Stripe.
Softr has some built-in data sources (e.g., Airtable, Notion, Google Sheets, SQL, …). To connect other data sources, use the Softr Rest API. You can find this option in the admin panel. Here you can connect any app with an API and set up the connections you need.
REST APIs have endpoints. You can call these endpoints using HTTP requests to get and process data. Each API structure differs, though conceptually is the same.
Read the app's API documentation to learn about:
- Available API endpoints
- Required and optional parameters
- Request body format
- Authentication methods
You can also use ChatGPT or a similar LLM to get help on implementing this. The Softr Rest API builder provides all the fields needed to setup the API endpoint you need.
To make things concrete and help you understand the principles and process behind all of this, below is a video with a practical example using the Coda API. The same principles apply to using other REST APIs.
Let’s assume we want to retrieve Tasks from a table in Coda into our Softr app. Here is how we could implement this endpoint in Softr using the Coda API.
- Authentication: Coda uses a Bearer token for API requests. Find out details on the official documentation. You can create a new API token via your Account Settings in Coda (there is a Developer section toward the end).
Authentication: Coda uses a Bearer token for API requests. Find out details on the official documentation. You can create a new API token via your Account Settings in Coda (there is a Developer section toward the end).
- The HTTP method is “GET”
- The URL is https://coda.io/apis/v1/docs/ oM8845FZ5_uB /tables/ grid-6h548r0Jee /rows - where the highlighted strings are the *Coda Doc ID *and the table ID. You can find your Coda Doc ID by pasting the Doc URL here. You can get a Table ID by clicking on the three dots to the left of the target table > Copy table ID.
- Optionally, you can include URL parameters and placeholders / static values as part of your HTTP request. The available URL parameters depend on the endpoint you use. For the List table rows endpoint, we can use these parameters: query
- sortBy
- useColumnNames
- valueFormat
- visibleOnly
- limit
- pageToken
- syncToken
The HTTP method is “GET”
The URL is https://coda.io/apis/v1/docs/ oM8845FZ5_uB /tables/ grid-6h548r0Jee /rows - where the highlighted strings are the *Coda Doc ID *and the table ID. You can find your Coda Doc ID by pasting the Doc URL here. You can get a Table ID by clicking on the three dots to the left of the target table > Copy table ID.
Optionally, you can include URL parameters and placeholders / static values as part of your HTTP request. The available URL parameters depend on the endpoint you use. For the List table rows endpoint, we can use these parameters:
- query
- sortBy
- useColumnNames
- valueFormat
- visibleOnly
- limit
- pageToken
- syncToken
- Finally, we can setup a Transformer function to flatten the “values” collection in the response and return the values at the top level of the response, so we can use them in dynamic Softr blocks
Finally, we can setup a Transformer function to flatten the “values” collection in the response and return the values at the top level of the response, so we can use them in dynamic Softr blocks
The original (non-transformed) Coda API response looks like this:
You can notice that “values” is an object/collection containing each row in the table and all their associated column values. The row values are nested within the values object, making them inaccessible in Softr with this schema. So, the Transformer function above “flattens” the “values” object allowing us to directly access each row and their columns in our Softr apps.
Featured products
Resources
Softr REST API - Official Documentation
Affiliate Links
- Do you work at a startup? Get 3 months of Notion Plus for free, plus unlimited AI. Visit https://www.notion.so/startups, select Simone Smerilli as an affiliate partner in the drop-down list, and enter the unique code SimoneSmerilliXNotion at the end of the form.
- Get access to Notion AI
- Sign up to Notion for free
- Sign up for Coda
- Build your web forms with Tally (integrates natively with many tools)
- Get one free month on the pro plan in Make (automation software)
- Build your knowledge base with Notion & HelpKit
- Build your website with Notion and Super