--- title: "Custom-Schema Connectors" slug: "flexible-schema-connectors-via-api" description: "Flexible-schema connectors in Dataddo allow extracting data from a range of sources, even if they do not conform to a pre-defined schema or dataset structure." updated: 2023-12-19T09:48:07Z published: 2023-12-19T09:48:07Z canonical: "docs.dataddo.com/flexible-schema-connectors-via-api" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.dataddo.com/llms.txt > Use this file to discover all available pages before exploring further. # Custom-Schema Connectors Custom-schema connectors in Dataddo allow you to extract data from a wide range of sources, even if they do not conform to a pre-defined schema or dataset structure. With custom-schema connectors, you have the flexibility to capture and use any data that is important to your business, regardless of its structure or format. Examples of such connectors are [Google Analytics 4](/docs/google-analytics-4), [Google Ads](/docs/google-ads), [Facebook Post](/docs/facebook-post-insights), [Hubspot](/docs/hubspot), [Netsuite](/docs/netsuite), [Salesforce](/docs/salesforce) or any database connectors (e.g. [MySQL](/docs/mysql)). ## Prerequisites - You have the link to [API endpoint documentation](https://headless.dataddo.com/). - You have [authorized a service](/headless/docs/creating-an-authorizer) are going to connect to. ## Implementation Flexible-schema connectors require the following workflow: 1. Call the **/connectors/{connectorId}/actions/authorization** endpoint for obtain the list of active authorizers. If none is available [create a new one](/headless/docs/creating-an-authorizer-via-api). ID of the authorizer is passed as **oAuthId** parameter to the payload. 2. Check the [documentation](https://headless.dataddo.com/) for required parameters. Each of the flexible-schema connectors has a different payload structure in order to provide the desired schema flexibility. The final payload is a merge between [common](/headless/docs/flexible-schema-connectors-via-api#common-parameters) and [connector-specific](/headless/docs/flexible-schema-connectors-via-api#connectorspecific-parameters) parameters. 3. Send the full payload to the **/connectors/{connectorId}/preview** endpoint to test the functionality of the payload. If successful, you can create the source by calling **/connectors/{connectorId}/create-source** endpoint. ## Payload Schema Use the schema when calling **/preview** and **/create-source** endpoints for testing the payload and creating the source. Although **part of the payload is common** for all flexible-schema connectors (see the code excerpt below), **each custom-schema connector requires additional specific set of params** to be supplied in the payload. ### Common Parameters In Dataddo, common parameters refer to a set of configuration options that are shared across all flexible-schema connectors. These parameters can be used to define common settings for each connector, such as authentication credentials or scheduling options. Note the three dots (...) in the code snippet below. Those need to be replaced by [connector-specific](/headless/docs/flexible-schema-connectors-via-api#connectorspecific-parameters) parameters. ``` POST /connectors/{connectorId}/create-source { "connectorId":"CONNECTOR_ID", "templateId":"index", "label":"YOUR_LABEL", "type":"CONNECTOR_ID", "oAuthId":OAUTH_ID, ... "syncFrequency":"custom", "hour":"3", "minute":"25", "dayOfWeek":"*", "dayOfMonth":"*", "month":"*", "timezone":"UTC", "dateRange":"{{30d1}}", "strategy":"clean" } ``` | Param | Type | Description | | --- | --- | --- | | **connectorId** | STRING | Use same identifier as in URL. | | **templateId** | STRING | Use index as value. | | **label** | STRING | Use any value for the description of the newly created source. | | **type** | STRING | Use the same value as for **connectorId**. | | **oAuthId** | STRING | ID of the authorizer to be used. Call /authorization endpoint to obtain the list of authorizers. | | **strategy** | ENUM | Default is **clean**. You can use **incremental** if you want to incrementally storing data in Dataddo SmartCache. | | **timezone** | STRING | Timezone name (e.g. Europe/London). Full list available in [timezone list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). | | **syncFrequency** | STRING | Use custom as value. | | **minute** | STRING | Minute (0 - 59). Compatible with Cron expression. | | hour | STRING | Hour (0 - 23). Compatible with Cron expression. | | dayOfWeek | STRING | Day of the week (0 - 6) (Sunday to Saturday). Compatible with Cron expression. | | dayOfMonth | STRING | Day of the month (1 - 31). Compatible with Cron expression. | | month | STRING | Month in year (1 - 12). Compatible with Cron expression. | ### Connector-specific parameters Connector-specific parameters are unique to each flexible-schema connector and are used to customize the connector's behavior and define its specific configuration options. See the examples of Snapchat, Linkedin Ads or Facebook Ads below. Note the three dots (...) in the code snippets below. Those need to be replaced by [common parameters](/headless/docs/flexible-schema-connectors-via-api#common-parameters). #### Snapchat Follow the [endpoint documentation](https://headless.dataddo.com/#/connectors.snapchat/snapchatControllerActionLoad). Parameters **organizationId**, **accountId**, **breakdown**, **metrics**, **labels**, **action_report_time**, **swipe_up_attribution_window** and **view_attribution_window** are required. See full example with data types and sample values in the snippet below. ``` POST /connectors/snapchat/create-source { ... "organizationId":"ORGANIZATION_ID", "accountId":"ACCOUNT_ID", "breakdown":"campaign", "metrics":["spend","impressions"], "labels":["stats_id","stats_type","stats_start_time","stats_end_time"], "action_report_time":"conversion", "swipe_up_attribution_window":"28_DAY", "view_attribution_window":"1_DAY" ... } ``` #### Linkedin Ads Follow the [endpoint documentation](https://headless.dataddo.com/#/connectors.linkedin/linkedinControllerActionLoad). Parameters **accountId**, **pivot**, **timeGranularity**, **metric** and **dataLabel** are required. See full example with data types and sample values in the snippet below. ``` POST /connectors/linkedin/create-source { ... "accountId":123456, "pivot":"campaign", "timeGranularity":"DAILY", "metric": ["comments","shares","follows","companyPageClicks","totalEngagements","costInLocalCurrency"], "dataLabel": ["date_start","date_stop","account_id","account_name","campaign_id","campaign_name"] ... } ``` #### Facebook Ads Follow the [endpoint documentation](https://headless.dataddo.com/#/connectors.facebookAds/facebookAdsControllerActionLoad). Parameters **accountId**, **level**, **dataLabel**, **metric** and **timeBreakup** required. See full example with data types and sample values in the snippet below. ``` POST /connectors/facebook_ads/create-source { ... "accountId": "act_000000000", "level": "ad", "dataLabel": ["account_currency","account_id","account_name","ad_id","ad_name","adset_id","insert_date"], "metric": ["action_values.add_to_cart","actions.purchase","clicks","cost_per_unique_inline_link_click","cpc","ctr","spend","video_30_sec_watched_actions.video_view","video_p95_watched_actions.video_view"], "timeBreakup": "1", "breakdown": "", "attributionWindow": "\"28d_click\"", "reportTime": "conversion", "filter": "[{\"field\":\"publisher_platform\",\"operator\":\"CONTAIN\",\"value\":\"facebook\"}]", ... } ``` ## Example The example below demostrates the merging of [common](/headless/docs/flexible-schema-connectors-via-api#common-parameters) and [connector-specific](/headless/docs/flexible-schema-connectors-via-api#connectorspecific-parameters) parameters to form a payload to be send to **/connectors/{connectorId}/create-source** endpoint to create a source. ``` POST /connectors/snapchat/create-source { "connectorId":"snapchat", "templateId":"index", "label":"Snapchat Insights", "type":"snapchat", "oAuthId":OAUTH_ID, "organizationId":"ORGANIZATION_ID", "accountId":"ACCOUNT_ID", "breakdown":"campaign", "metrics":["spend","impressions"], "labels":["stats_id","stats_type","stats_start_time","stats_end_time"], "action_report_time":"conversion", "swipe_up_attribution_window":"28_DAY", "view_attribution_window":"1_DAY", "syncFrequency":"custom", "hour":"3", "minute":"25", "dayOfWeek":"*", "dayOfMonth":"*", "month":"*", "timezone":"UTC", "dateRange":"{{30d1}}", "strategy":"clean" } ```