> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.dorik.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Public API

# Getting Started

Dorik’s Public API feature allows users to connect with other applications on the web. User can maintain their resource without coming back to their Dorik website. The endpoints created can allow any authenticated user/platform to perform create, read, update, and delete (CRUD) actions. For now, Public API can be used to fetch data from your **CMS** **collections, collection items, and collection fields** as a beta service.

---

# Create a Public API token

For more details on that, go to the documentation below:

[Generating Public API Keys](/en/article/generating-public-api-keys-1g7ar0/)

---

# Use Case - 1: Connect Dorik API with External Database

Bringing your data from Airtable into your custom collection through Zapier or other similar platforms. Follow the steps below:

## Dorik API with Zapier

1. **Airtable**
    - Create a base on your Airtable account
    - Create a new table
    - You can fetch the following data into your Custom collections (Text, slug, and HTML content)
    - For this example, create a table with the following columns (Name, slug, and htmlContent)

2. **Zapier**
    - Go to your Zapier account and **Create a Zap**
    - Search for Airtable in the first step (1. Trigger)
    - Choose the Event type as “New Record”
    - Connect your Airtable by signing in
    - During the authentication, choose your base by clicking on **+Add a base**
    - Choose the base that you have created
    - Press **Grant Access**
    - Then press **Continue**

3. **Zapier Trigger**
    - After authentication, comes step 3
    - Choose your base
    - Choose the table
    - Choose a ‘Limit to view’
    - Choose **‘Include File Content’** as **False**
    - Press **Continue**

4. **Test your trigger**
    - Press **Test Trigger**
    - Choose a record
    - If the record data matches the one in your base, press **Continue**

5. **Webhook**
    - After setting up the trigger, choose an App and Event
    - Look up ‘Webhooks by Zapier’
    - In the next step, create an Action
    - Choose the Event type as POST
    - Paste your Custom Collection item’s link
    - Choose the Payload type as JSON
    - Insert the data and align them with the columns of your Airtable table
    - Choose “No” under **Wrap Request in Array**
    - Choose “Yes” under **Unflatten**
    
    6. **Dorik API**
        - Go to your CMS Dashboard
        - Choose Settings
        - Go to the **API Keys** tab
        - Click on `**+ Generate Keys**`
        - Give a name to your Key
        - Press **`Generate`**
        - Copy the API key
        
    7. **Zapier <> Dorik**
        - Go back to Zapier
        - Paste your API key under **Headers**
        - Give the header a name. e.g x-dorik-key
        - Press **Continue**
        - Press **Test Action**
        - And lastly publish the Zap.


---

## Dorik API with Pabbly

1. **Airtable**
    - Create a base on your Airtable account
    - Create a new table
    - You can fetch the following data into your Custom collections (name, slug, and HTML content)
    - For this example, create a table with the following columns (name, slug, and htmlContent, Created Time [**mendatory**])

2. **Pabbly**
    - Go to your Pabbly account and **Create a workflow**
    - Search for Airtable in the first step (1. Trigger)
    - Choose the Event type as “New Record”
    - Connect your Airtable by **adding new connection** and Airtable **Personal access Token**
    - During the authentication, choose your base by clicking on +**Add a Scope** and **+Add a base**
    - Choose the base, table and trigger field that you have created
    - Then press **Continue**

3. **Test Trigger**
    - Press **Save & Test Request**
    - Choose a record
    - If the record data matches the one in your base, press **Continue**

4. **API by Pabbly**
    - After setting up the trigger, choose an Action
    - Look up ‘API by Pabbly’
    - In the next step, create an Action Event type as POST
    - Paste your Custom Collection item’s link in the Endpoint URL
    - Choose the Payload type as JSON
    - Choose “No” under **Wrap Request in Array**
    - Choose “No Auth” under the **Authentication**
    - Click the checkbox of **Add Headers** and **Set Perameters**
    - Insert the data on the **Set Parameters** field and align them with the columns of your Airtable table
    
5. **Pabbly**  **<> Dorik**
    - Go back to Pabbly
    - Paste your API key under **Add** **Headers**
    - Give the header a name. e.g x-dorik-key
    - Press **Continue**
    - Press **Test Action**
    - Save the Workflow.


---

# Use Case - 2: Creating a collection using Dorik’s custom form

## Dorik API automation with Integromat

1. 
**Dorik**
    - Take a Custom Form.
    - Take appropriate fields according to the Custom Collection fields keyname (e.g: name, slug, htmlContent, etc).
    - You can fetch the following data into your Custom collections (name, slug, and HTML content)
    - Connect Integromat with the form through **Form Configuration**.
    - Paste the webhook URL on the **Webhook URL** input field in your Form Configuration option.
    - Click on the **Click here** link on the bullet instructions given in your modal editor. The text is “Click here to send test data.”
    - Integromat will automatically connect with the input fields of your custom form.

2. 
**Integromat**
    - Go to your Integromat account and **Create a new scenario**
    - Choose **Webhook** and copy the **Webhook URL**

3. 
**Dorik**
    - Return to your site and paste the webhook URL in the Form Configuration's Webhook URL input field.
    - Click the "Click here" link in the bullet instructions of your modal editor to automatically connect Integromat with the input fields of your custom form.

4. 
**Integromat**
    - Go to your integrated dashboard, search **Http,** and connect with it.
    - In the next step, paste your Custom Collection item’s link in the **URL**
    - Create a Method type as POST
    - Paste your Custom Collection item’s link in the Endpoint URL
    - Choose the Payload type as JSON
    - Paste your API key under **Headers**
    - Give the header a name. e.g. x-dorik-key
    - Go to the **Body type** option and choose **Raw.**
    - Choose **Content type** as JSON (application/json)
    - Set the **Request content** according to your field keyname and fetch data from the previous webhook step. Make sure to add the publish and status options to pass your data on real time.
        - As example:
            
            ```markup
            {
            	"name" : " ",
            	"slug" : " ",
            	"htmlContent" : " ",
            	"publish" : "true",
            	"status" : "PUBLISHED"
            }
            ```
            
    - Choose “No” under the **Parse response**
    - Click **Ok**.

5. 
**Test Trigger**
    - Click the **Run Once** button on Integromat.
    - Go to your Dorik site dashboard, publish it, and go to the live site.
    - Fill up the form fields and hit the **submit** button.
    - Go to your site's Custom Collection dashboard to check the data is fetched there.
    - Also, go to the Integromat dashboard, and you will see that here received new data.


---

## Dorik API automation with Pabbly

1. 
**Dorik**
    - Take a Custom Form.
    - Take appropriate fields according to the Custom Collection fields keyname (e.g: name, slug, htmlContent, etc).
    - You can fetch the following data into your Custom collections (name, slug, and HTML content)
    - Connect Pabbly with the form through **Form Configuration**.
    - Paste the webhook URL on the **Webhook URL** input field in your Form Configuration option.
    - Click on the **Click here** link on the bullet instructions given in your modal editor. The text is “Click here to send test data.”
    - Pabbly will automatically connect with the input fields of your custom form.

2. 
**Pabbly**
    - Go to your Pabbly account and **Create a workflow**
    - Choose **Webhook** and copy the **Webhook URL**

3. 
**Dorik**
    - Return to your site and paste the webhook URL in the Form Configuration's Webhook URL input field.
    - Click the "Click here" link in the bullet instructions of your modal editor to automatically connect Pabbly with the input fields of your custom form.
    - Publish your site.

4. 
**Test Trigger**
    - Go to your Pabbly dashboard and click **Capture Response** Button.
    - You will receive the response from your site custom form.
    
5. 
**API by Pabbly**
    - After setting up the trigger, choose the next application.
    - Search for ‘**API by Pabbly**’ and click on it.
    - In the next step, create an Action Event type as POST
    - Paste your Custom Collection item’s link in the Endpoint URL
    - Choose the Payload type as JSON
    - Choose “No” under **Wrap Request in Array**
    - Choose “No Auth” under the **Authentication**
    - Click the checkbox of **Add Headers** and **Set Parameters**
    - Insert the data on the **Set Parameters** field and align them with the columns of your Airtable table

6. 
**Test Trigger**
    - Click the **Save & send test request** button on Pabbly.
    - Go to your Dorik site dashboard, publish it, and go to the live site.
    - Fill up the form fields and hit the **submit** button.
    - Go to your site's Custom Collection dashboard to check the data is fetched there.
    - Also, go to the Pabbly dashboard, and you will see that here received new data.
    - Click the **Save** button to publish the Pabbly Workflow.


---

# Related articles

[Generating Public API Keys](/en/article/generating-public-api-keys-1g7ar0/)



