abstra-docs
Search…
Calling Connectors or Tables from outside Abstra
In this tutorial you will learn how to call/use methods and queries from outside Abstra.

Generating API Token

If your method or query is not protected you can skip this step.
Abstra uses by default the tokens of the logged user to authenticate protected methods or queries. But if you are programmatically accessing then there user is no user.
Instead you need to go to your project and click in Setting > Authentication and scroll down to the Manage your tokens section. There you can create and delete tokens.
Be aware. If you delete a token that another automation is using, it will lose access to the resources

Execute a Connector Method

To call a method you need at least the method id and the connector type
To execute it all you have to do is a POST request on:
1
https://remote-actions.services.abstra.app/v2/execute/<CONNECTOR-TYPE>
Copied!
The body should be JSON-encoded and follow the template:
1
{
2
"props": {
3
"id": <METHOD-ID>,
4
"args": <ARGS>
5
}
6
}
Copied!
If the connector is protected you need to pass the following header with the bearer token:
1
"Api-Authorization" : "Bearer <API-TOKEN>"
Copied!

About connector type

The following is the mapping of connector types that can be called from outside Abstra
  • Airtable: airtable
  • DynamoDb: dynamodb
  • Email: email
  • MongoDb: mongodb
  • MySQL: mysql
  • Postgres: postgres
  • SQLServer: sqlserver
  • SSH: ssh

About ARGS

The ARGS value is what the method expects to run.

Key Value Dictionary

For the following Connectors, the value of ARGS is a key:value dictionary/object with the keys specified in the methods and their values
For Airtable, Email, MongoDb and SQLServer, the key is a word preceded the the dollar sign $. Example: The following e-mail method specified the parameters $amount and $price
So the body should look like this:
1
{
2
"props": {
3
"id": <METHOD-ID>,
4
"args": {
5
"$amount": 123,
6
"$price": "USD 1.5"
7
}
8
}
9
}
Copied!
For DynamoDb and SSH is the same but the keys start with the colon :

List

With Postgres Connector you specify numeric parameters ($1, $2, etc...), so your ARGS value will be a list ordered by the number. Example: The following query requires two parameters $1 and $2
So the body should look like this:
1
{
2
"props": {
3
"id": <METHOD-ID>,
4
"args": [
5
123123123123,
6
"% reyel %"
7
]
8
}
9
}
Copied!

Execute a Tables Query

To call a query you need at least the statement id
To execute it all you have to do is a POST request on:
1
https://tables.services.abstra.app/execute/:statementId
Copied!
The body should be JSON-encoded with the params you specified.
The application should have at least the following header:
1
"Content-Type" : "application/json"
Copied!
If the query is protected you need to pass the following header with the bearer token:
1
"Api-Authorization" : "Bearer <API-TOKEN>"
Copied!

About the body

SQL Queries

With SQL queries you specify named parameters ($name, $foo, etc...) so your ARGS value will be an object with the paths specified by the names.
Example: The following query requires three parameters $id, $new.name and $new.value.
So the body should look like this:
1
{
2
"id": "TEST_ID",
3
"new": {
4
"name": "TEST_NAME",
5
"value": "TEST_VALUE"
6
}
7
}
Copied!

Visual Queries

With Visual queries you specify filter and write parameters (write.name, filter.id, etc...) so your ARGS value will be a list with dictionaries/objects containing param and value keys.
Example: The following query requires two parameters write.name and filter.id
So the body should look like this:
1
{
2
"filter": {
3
"id": "TEST_ID"
4
},
5
"write": {
6
"name": "TEST_NAME"
7
}
8
}
Copied!
Last modified 16d ago