Syncs
Create a sync
Create a sync between two apps from the tables and columns you pair with mapping ids. Stacksync reads both apps, checks every table and column, creates the tables marked create_new_table and stores the sync switched off: switch it on with the switch route. Send validate_only: true to run every check and get the sync as it would be stored without creating it.
Authorization
AuthorizationstringheaderrequiredBearer <key>, where <key> is a workspace API key or a user API key. See Authentication.
workspace_id*integerThe workspace the resources belong to
The sync to create
application/json- body
The sync to create: two apps whose tables and columns are paired by the mapping ids you choose
base_name*stringThe name of the sync. 3 to 63 characters: unaccented letters (A-Z, a-z), numbers, underscores, dashes and spaces only; unique in the workspace
base_region*stringThe data region the sync runs in; the connections must be in it
"besg""usnv"apps*array<>Exactly two apps
2 <= items <= 2base_resource_id?stringA stable id of your choosing, 1 to 60 letters, digits or underscores, unique in the workspace; derived from the name when left out
^[A-Za-z0-9_]{1,60}$base_status?stringAccepted and stored as given; leave it out so Stacksync sets the state of the new sync itself
folder_id?stringThe folder of the workspace, in base_region, to file the sync under; the root when left out
uuidvalidate_only?booleanRun every check of the create, including reading the apps, and answer the sync as it would be stored (its column names after renames, no base_id) without creating it
falseThe sync created (with validate_only, the sync as it would be stored, without base_id)
application/json- response
The written sync
data*A sync as a create or an edit answers it (the mapping, not the settings: read the sync for those)
curl -X POST 'https://api.stacksync.com/v1/workspaces/0/bases' \ -H 'Content-Type: application/json' \ -d '{ "base_name": "Salesforce accounts to Postgres", "base_region": "usnv", "base_resource_id": "salesforce_accounts_to_postgres", "folder_id": "e1f2a3b4-c5d6-4e7f-8a9b-0c1d2e3f4a5b", "apps": [ { "connection_id": "c7d8e9f0-2a3b-4c5d-9e6f-7a8b9c0d1e2f", "tables": [ { "table_name": "Account", "table_mapping_id": "7e8f9a0b-1c2d-4e3f-8a4b-5c6d7e8f9a0b", "sync_direction": "bidirectional", "table_options": { "create_new_table": false }, "columns": [ { "column_name": "Name", "column_mapping_id": "1a2b3c4d-5e6f-4a7b-9c8d-0e1f2a3b4c5d" }, { "column_name": "Website", "column_mapping_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e" } ] } ], "rate_limit": { "rate": 50, "frequency": 1 } }, { "connection_id": "9b2e4f60-1c3d-4a5e-8f70-2d4c6e8a0b12", "tables": [ { "table_name": "accounts", "table_mapping_id": "7e8f9a0b-1c2d-4e3f-8a4b-5c6d7e8f9a0b", "sync_direction": "bidirectional", "table_options": { "create_new_table": true, "primary_key": { "column_name": "account_id", "data_type": "text" } }, "columns": [ { "column_name": "name", "column_mapping_id": "1a2b3c4d-5e6f-4a7b-9c8d-0e1f2a3b4c5d" }, { "column_name": "website", "column_mapping_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e" } ] } ], "app_options": { "delete_protection": true } } ]}'{ "data": { "base_id": "3f6c1d2e-8a4b-4c7d-9e21-5b6f7a8c9d01", "base_name": "Salesforce accounts to Postgres", "base_region": "usnv", "base_resource_id": "salesforce_accounts_to_postgres", "apps": [ { "app_id": "3f9a1c2e", "connection_id": "c7d8e9f0-2a3b-4c5d-9e6f-7a8b9c0d1e2f", "rate_limit": { "rate": 50, "frequency": 1 }, "tables": [ { "table_name": "Account", "table_mapping_id": "7e8f9a0b-1c2d-4e3f-8a4b-5c6d7e8f9a0b", "sync_direction": "bidirectional", "columns": [ { "column_name": "Name", "column_mapping_id": "1a2b3c4d-5e6f-4a7b-9c8d-0e1f2a3b4c5d" }, { "column_name": "Website", "column_mapping_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e" } ] } ] }, { "app_id": "b71d04e5", "connection_id": "9b2e4f60-1c3d-4a5e-8f70-2d4c6e8a0b12", "tables": [ { "table_name": "accounts", "table_mapping_id": "7e8f9a0b-1c2d-4e3f-8a4b-5c6d7e8f9a0b", "sync_direction": "bidirectional", "columns": [ { "column_name": "name", "column_mapping_id": "1a2b3c4d-5e6f-4a7b-9c8d-0e1f2a3b4c5d" }, { "column_name": "website", "column_mapping_id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e" } ] } ] } ] }}