The Orgzit Web API is an interface for querying information from and enacting change in an Orgzit workspace. You can use the API not only to fetch records but also to create records and update records in Orgzit.
Below is a snapshot of a Task Tracker workspace. Let’s see the steps to fetch records from the Task Tracker table by API Integration.
Fetch Records
Fetching records through API is a three-step process:
Accessing the API Key
Making a Record Fetch Request
Making the Requests to Fetch the Records and Getting the Response
1. Accessing the API Key
To access your API Key, follow the steps mentioned in this support article.
2. Making a Record Fetch Request
Once you retrieve the API key from your account, you can start making requests with the API.
You will need to pass the key to the API in the header of your requests. Paste the key you copied in the Authorization Header.
Set the Request Method to PUT.
The Request URL has the following format:
https://account_name.orgzit.com/api/1/record/filter/?limit=20
where the account_name is the name of your Orgzit account.
In the shared collection, it is https://orgzitapidemo.orgzit.com/api/1/record/filter/?limit=20
In the above-mentioned Request URL, the Query Parameter is limit. The value of limit shows the number of records you will fetch at a time.
Set the Request Payload in the JSON format.
{
"dataform": "jhtxltf37l",
"filters": null,
"getfieldvalues": false,
"use_field_slug": true
}
Dataform
Dataform refers to the Table that you are integrating with. Here, jhtxltf37l is the dataform_id.
You can find the dataform_id in the URL just before your dataform/table name.
Here, the URL is https://orgzitapidemo.orgzit.com/app/#p/p569l5eo7u/task-tracker/jhtxltf37l/tasks
Here, task tracker is the dataform/table, and jhtxltf37l is the dataform_id.
3. Making the Requests to Fetch the Records and Getting the Response
Once you send your API request now, you will fetch the first 20 records from your specified table.
Here is a snapshot of the response. It has successfully fetched the first 20 records from the Task Tracker table.
Fetch Records with Pagination Offset
To fetch records with a pagination offset, you can set the offset query parameter in your request URL.
https://account_name.orgzit.com/api/1/record/filter/dataform_id/?limit=20&offset=20
Fetch Records with Filters
To fetch records with filters applied, you can mention the filters in your Request Payload.
{
"dataform": "jhtxltf37l",
"filters": [
{
"field": "status",
"op": "contains",
"values": [
"new"
]
}
],
"getfieldvalues": false,
"use_field_slug": true
}
Here, the field depicts the name of the field on which the filter is applied, op depicts the condition on which data is being filtered (here, it is ‘contains’) and values show the value on which the filter condition is being applied.
You can find the list of all possible Filter Conditions according to the data type in the support doc here.