Skip to main content

Converting cURL to Pipes

Understanding How cURL Requests Translate to Tadabase Pipes

When integrating external APIs with Tadabase through Pipes, you often need to translate a cURL request into the corresponding fields and settings in Tadabase. Below, we’ll break down a few example cURL requests and explain how each part relates to configuring a Tadabase Pipe.

Example 1: Basic GET Request

cURL Request:

curl -X GET "https://api.example.com/v1/users" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Breakdown:

Method: GET

add-page.png

Tadabase Pipes: In the Tadabase Pipe, this corresponds to selecting the GET method for the Pipe action. The GET method is used when you are retrieving data from an API.

URL: https://api.example.com/v1/users

add-page.png

Tadabase Pipes: In the Tadabase Pipe setup, the Request URL is the endpoint where the data will be fetched from. This exact URL (https://api.example.com/v1/users) should be entered as the API Endpoint URL.

Headers: Authorization: Bearer YOUR_ACCESS_TOKEN

add-page.png

Tadabase Pipes: The Authorization header passes the Bearer token needed for authenticating the request. In Tadabase Pipes, you’ll need to add this under the Headers section. You would add:

  • Header Key: Authorization
  • Header Value: Bearer YOUR_ACCESS_TOKEN

Example 2: POST Request with JSON Payload

cURL Request:

curl -X POST "https://api.example.com/v1/users" \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"name": "John Doe", "email": "john.doe@example.com"}'

Method: POST

add-page.png

Tadabase Pipes: In the Tadabase Pipe, select POST as the method. POST is used when you want to send data to create or update a resource.

URL: https://api.example.com/v1/users

add-page.png

Tadabase Pipes: Similar to the previous example, this is the API Endpoint URL where the POST request will be made.

Headers: Authorization: Bearer YOUR_ACCESS_TOKEN and Content-Type: application/json

add-page.png

Tadabase Pipes: Add both headers in the Headers section:

    • Header 1 Key: Authorization, Header 1 Value: Bearer YOUR_ACCESS_TOKEN
    • Header 2 Key: Content-Type, Header 2 Value: application/json

Data: -d '{"name": "John Doe", "email": "john.doe@example.com"}'

add-page.png

Tadabase Pipes: This is the Body of the request. Since it's JSON data, you would configure the body in the Tadabase Pipe by selecting the Raw Body (JSON) option and inputting the JSON data:

Troubleshooting

See full output

To see the full request that's being sent behind the scenes, it's helpful to use a service that can show you the request it received from the Tadabase servers. 

We recommend using webhook.site for this and you can do so as follows: 

Go to Webhook.site and get the Unique URL:

add-page.png

Paste the URL in the URL field of your pipe (It's best to create a copy for testing)

add-page.png

Next get the "Pipesscript" code by clicking "Copy Code" 

add-page.png

Paste the code in any pages Javascript: 

add-page.png

Preview the page and view the console