Overview
Built atop our asynchronous API, Cordial's Scriptable API allows you to set custom authentication, responses, and payload schemas that align with Cordial's data structure using Smarty scripts. This feature streamlines the process of facilitating integrations between Cordial and other applications that provide value for your business.
- Asynchronous API: A REST API with defined Cordial schemas for payloads. It works for the same use cases as third-party APIs, but it's asynchronous and built for better throughput.
- Scriptable API: A toolset built atop our asynchronous API that performs the functions mentioned in the overview paragraph above.
When to use the Scriptable API v. Asynchronous API
Our Scriptable API should only be used in cases when you can't use the asynchronous API on its own, such as when custom authentication is required or your data needs to undergo a transformation in order to align with Cordial's schema.
How it works
Here's the workflow for our Scriptable API:
- Receive request: Get all settings by Scriptable endpoint ID.
- Authentication: By API key (default) or Smarty script.
- Transformation script: Transform payload into commands.
- Response: Can be set to default or custom.
Create Scriptable API endpoint
1. To create a Scriptable API endpoint in Cordial, log in and navigate to Integrations > Scriptable API.
2. Select New and create a name for your endpoint.
3. Select Edit under Scriptable API Payload to configure the payload for your endpoint.
4. Select the Authentication type: API Key or Scripted.
API key is Cordial's preferred authentication method. Scripted should only be used for integrations that don't allow you to use Cordial API keys for authentication.
- When using API Key as the authentication type, enter the Smarty script you'll use to transform your data in the Transformation editor.
- When using Scripted as the authentication type, enter the appropriate Smarty script into the Authentication script and Transformation editor panes.
5. Add optional Secrets and keys below the Transformation editor.
6. Save your configured payload and click Enable.
7. You can copy your Scriptable API URL by clicking the arrow under the name.
8. Once your Scriptable API is saved, you can also copy the URL by navigating back to Integrations > Scriptable API and clicking the Copy to clipboard icon.
9. You can now use the URL you created to send API calls.
Scriptable utilities
Scriptable API utilities create additional capabilities for our Scriptable API, using Smarty scripts to transform data for compatibility and provide authentication.
Remove Scriptable endpoint
You can remove a Scriptable API endpoint by hovering over the arrow in the table row and clicking Remove, or by selecting the endpoint and clicking the X button.
Comments
0 comments
Please sign in to leave a comment.