Posting data into agileBase from external systems

Posting data into agileBase from external systems

To read data from agileBase to external apps, you can use our JSON API. To get data in, it can be posted in as follows. Note there are other alternatives such as direct ODBC access or Zapier integration.

Preparing a form for input

Firstly, in the agileBase administrator interface, turn on the option to allow data to be posted from public sources, e.g. a web form.

Under ‘build’, choose the relevant table, go to the manage tab, press ‘options’ and tick ‘public data entry’.

api in

Optionally, you can add an email address to notify when a new item is added and an autoresponse text which will be sent to any email addresses found in the posted data.

To protect the system from spam input, we also suggest you tick ‘Require API key’ and reload the table to show the API key generated. This then has to be submitted with every POST request as the value of the HTTP Authorization header.

Creating new records

Clicking the ‘sample form’ link will then show a sample form which can be used for testing or to copy code from. Here’s an example:

sample forum

Usually there’ll be some tweaks you want to make. For example you may want to hard code certain values, which can be done by replacing form fields with hidden fields ( in HTML. Feel free to download the source of this form and edit it as appropriate. You will then of course have full control over styling and layout.

If you want to submit data directly from an app rather than a web form, simply prepare a HTTP POST request that mimics the form. Again, use the source code of the form as a reference. Note the form contains three hidden fields that need to be included. They are listed at the start of the sample form, for reference they are:

  • save_new_record=true
  • c=[internalcompanyid]
  • t=[internaltableid]

The post URL is

https://appserver.gtportalbase.com/agileBase/Public.ab

The form needs to be posted using the method POST

Remember also to set the ‘Authorization’ HTTP header if that option has been selected.

To use a form that agileBase generates but just alter the styling, the parameter ‘css’ can be provided. You’ll need to send us the CSS file or set it up to be automatically sync’d to our server. Please contact us to discuss this.

NB: To get the details of data posted into the database, please also supply the parameter

  • return=posted_json

This will include the internal row ID of the newly inserted record.

API use can be tested using the Postman extension for Google Chrome. Note that forms have to be posted with encoding type ‘application/x-www-form-urlencoded’.

Updating existing records

The process is similar, but instead of

  • save_new_record=true

supply

  • update_record=true
  • row_id=[internal id of the record]

The internal record ID can be got from a JSON feed or by using the ‘return=posted_json’ as above if editing a record previously created using the API.

HTTP response codes

401: unauthorised: the API key is missing or invalid

429: too many requests: the daily limit of requests to this table has been reached. Contact us to purchase additional capacity

507: insufficient storage: the limit on number of records which can be stored has been reached. Contact us to purchase additional capacity

500: some other server error


Last modified October 16, 2023: Create posting-from-external-systems.md (c79ae97)