API EditRecord | ADVANCED
API_EditRecord is another basic API component that allows the user to make an edit to a single record in Quick Base
Common use cases for using the API_EditRecord might include:
✓ Creating a custom button in Quick Base that will edit several fields at once
✓ Implement in Quick Base Webhooks to edit a record once certain changes occur
✓ Custom Scripting (either client or server side)
Imagine a scenario where you want to approve a record in Quick Base. You want to mark the record as approved, log the date it was approved and log the current user as the approver. To do so, you could create a button that uses API_EditRecord to create a seamless workflow.
EDITORS NOTE: This document will cover the URL Alternative for utilizing API_EditRecord. The URL alternative is applicable for use in native Quick Base buttons, Webhooks, as well as GET requests in custom scripting.This article does not cover POST Requests, although the details are transferrable.
The Quick Base example from their documentation is as follows:
Part 1 – the Target
The target is the Quick Base table you want to add a record in. The colored text below represents the target.
The target_domain is your Quick Base realm. In my case, my Quick Base realm is quandarycg.quickbase.com. So, the first part of my URL would look like –
The target_dbid is the table you want to edit a record in. Every table in Quick Base is uniquely identified by a table id. To find your unique table id, navigate your browser to the table where you are trying to edit a record. Once there, take a look at your browsers URL – the text you are looking for is the string of characters that immediately follow after the “/db/”, and stops before the “?a”. In the case of the Quandary CG Knowledge Base, we have a table for ‘External Records’ to hold test data from Knowledge Base users. That table is found via the following link for us:
Part 2 – the API Call
The API call is how you tell Quick Base what you are trying to do. It is the core piece that determines how Quick Base interprets everything else and what it needs from you. Everything in the API call should start with “?a=API_”. Since this document is about editing records, your full API call should read as “?a=API_EditRecord”. Make sure you do not forget the “API_” piece.The updated URL will be as follows:
Part 3 – Using App Tokens
Depending on your app – Application Tokens may or may not be required. For more info on how to use app tokens, please reference the Application Tokens article. If they are required, then your URL needs to call out that essential piece. Doing so requires that you add “&apptoken=” as the next part of your URL.The updated URL will be as follows:
Part 4 – Authentication/Ticket
A requirement of an API call is that the user or process making the call be logged in or authenticated in some form. For simplicity – I recommend using User Tokens. For an explanation of user tokens, please reference the User Tokens article. Incorporating a user token is similar to using apptokens, whereby you add an additional URL param to your API call for Quick Base to read. That string is “&usertoken=”. The updated URL will be as follows:
Part 5 – Establishing the RID
Since we are editing an existing record in Quick Base, part of your API_EditRecord needs to call out which record you want to edit. Doing so requires that identify somewhere in the URL string, the rid or the key of the record you want to change.
If you have set up your table to use a different Key field other than Record ID#, you can use the ‘key’ parameter. Otherwise, the more common usage and what will be detailed below is using the standard Quick Base Record ID# and the rid param.
To set your rid value – we will continue with the existing URL, and append a new param for ‘rid’, similar to below.
Where 12345 is the Record ID of the record you want edited
Part 6 – Setting Field Values
The last part of this process is determining what fields you want changed, and what values to change them to.
BEST PRACTICE: It is strongly recommended to use field ID’s instead of field names given that field names can be changed over time, while field ID’s are immutable. Doing so prevents you from having to update this part of your call
Setting different field values is just a matter of rinse and repeat using &fid#=. Make sure the field ID of the various inputs you want to set in the target table. Before you set up your API call, you should identify the various inputs you want to set and their associated Field IDs. With those identified, you will append &fid#=value to your URL string for each field you want a value set for. For example,
Field ID 6 = the Approval Status
Field ID 7 = the Approval Date
Field ID 8 = the approver
Your complete URL thus far would be –
Part 7 – Test it
To see it in action – head over to the Knowledge Base and try it out
In opposition to editing records – check out API_PurgeRecords for more info on how to remove records.
EDITORS NOTE: In March 2019, Quick Base released a clist Parameter that can now be included in all AddRecord and EditRecord calls. By including this in your API call – you can define a list of field ids such as “&clist=220.127.116.11.5” such that the XML response returns the value of these fields in the record
- Author: Chayce Duncan (email@example.com)
- Date Submitted: 12/18/2018