Every Block you build on GraceBlocks has an individualized API available that is organized around REST. It has predictable resource-oriented URLs, accepts form-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs. As we release new versions and tailor functionality, the functionality may change.
To access the GraceBlocks API documentation for your Block, you must have Builder level access in that Block. API keys are user-specific and will work across all Zones where the user has access authority. A user cannot perform more from actions via the API than their security access level for the Block will allow.
Accessing a Block's API documentation
To access your API key, and leverage the API documentation, follow the steps outlined below.
While in the role of Builder for the Block, click to enter the block from the GraceBlocks homepage.
The Block will load.
At the top of Block, page click the API icon.
The API for the Block will load in a new tab.
Working with a Block's API documentation
The visual below illustrates GraceBlock's API documentation and all that's available for a specific Block.
- Getting started: This section summarizes how the API works.
- Authentication: This section explains the mechanisms for how to authenticate including how to access your user-specific API key. Note: You do need builder access to see the API documentation for a Block. However, you do not need builder access in a Block for the API key to work. If you have a use case where you want a 3rd party to be able to read or write specific data about the block, you can restrict their security access level in the Block and the API key for their user account will honor these security level definitions. In this case, the third party can view their API key using a different block where they do have Builder access and you may need to share some elements of the API documentation with them that they can not directly view themselves.
- Errors: This section outlines the possible error codes that the API can return and how to interpret their meaning.
- Pagination: This section documents how collections of records will be organized. The vast majority of the API responses containing a collection of records will be paginated. When pulling records, use these two parameters to control how you receive the results: limit and starting_after.
- Tabs for the block: The section highlighted in yellow above represents the portion of the API documentation that is specific to the block. It will document how to reference fields and provide example data that you can copy for listing and getting records as well as how to create, update and delete records for that tab of the block.
- Generate API Key: This option is found inside the authentication section of the API documentation. Click the checkbox to show your user-specific API key. It is important to keep this key safe and hidden.
- Copying example code: Sample code always appears in the dark purple boxes on the page. You can copy this sample code to help you get started by using the copy to clipboard icon.