Integration

Xano - External API Request / cURL Commands

Summary

In this guide, we'll show you how to seamlessly integrate external APIs into your Xano backend. This process allows you to extend your application's functionality by leveraging third-party services without writing complex code.

Step 1: Create a Custom Function

First, create a new custom function in Xano by clicking the blue "+" button in the Function Stack. Scroll down and select the "External API Request" option.

Step 2: Import the API Endpoint

Click the "Import cURL" button at the top right corner of the function editor. Here, you can paste the API endpoint (cURL command) provided by the third-party service.

For example, let's use a SendGrid cURL command for demonstration purposes:

curl --request POST \ --url https://api.sendgrid.com/v3/mail/send \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Content-Type: application/json' \ --data '{"personalizations": [{"to": [{"email": "john@example.com"}]}], "from": {"email": "sender@example.com"}, "subject": "Hello, World!", "content": [{"type": "text/plain", "value": "Heya!"}]}'

Simply copy and paste this cURL command into the import field, and Xano will automatically parse the authentication details and request parameters.

Step 3: Import Request Parameters (Optional)

If the third-party service provides a sample request body, you can import it into Xano. In the "Parameters" dropdown, select "Actions" and then "Import from JSON." Paste the JSON object into the field and click "Import."

Step 4: Customize Request Parameters

Xano allows you to customize the request parameters by mapping them to inputs. For instance, if you want to use a dynamic email address instead of "john@example.com," you can create an input field called "email" and map it to the corresponding parameter value.

To do this, go to the "Inputs" section, create a new input named "email," and save it. Then, within the function editor, find the parameter value you want to replace (e.g., "john@example.com") and click the dropdown menu next to it. Select "Input" and choose the "email" input you just created.

Step 5: Review and Save

Review the external API request function to ensure all parameters are correctly mapped. Then, save the function, and you're ready to use it within your Xano backend!

By following these steps, you can easily integrate external APIs into your Xano backend, extending your application's capabilities without writing complex code. Xano simplifies the process by providing a visual interface for importing API endpoints, handling authentication, and customizing request parameters.

This transcript was AI generated to allow users to quickly answer technical questions about Xano.

Was this helpful?

I found it helpful

I need more support
Sign up for XanoSign up for Xano

Build without limits on a secure, scalable backend.

Unblock your team's progress and create a backend that will scale for free.

Start building for free