Skip to main content

External API Send Persisted Collection Data as Default JSON

In this video tutorial you will learn how to make a rest API call from DrapCode. You can store the data in DrapCode and then send this data to an external API.

1. Create an External API

To get data from any third-party integration like Xano you need to create an External API. External APIs are modules that are used to create a Rest API such as GET API, POST API, DELETE, etc. Although you may also use an existing API too.

APIs can be accessed from Settings → External API or from the top right hand-side. Then select the Create External API button. Give a name to your external API.

DrapCode Builder Font Family

1.1 Configure the API

You need to choose a call to create. Then copy the URL from Xano's Swagger Documentation.

DrapCode Builder Font Family

1.2 Request Data Mapping

Here you have to fetch the data from a persisted collection choose Send Collection Data and the Collection from the dropdown. Specify the Authorization, Bearer and Token from the documentation. Then click Save Setting to finish the process.

DrapCode Builder Font Family

1.3 Map the Collection Data

To map the data from collection mention the data key that has the records in it, specify what is the key to uniquely identify the records for eg., ID and mention the JSON path for other fields. Then choose Default JSON. You can copy the fields from the documentation here and replace the fields with their unqiue names as in the collection. Then click Save Settings to finish the process.

DrapCode Builder Font Family

2.Drop a Collection Form

Go to Pages Components and drop a Collection Form to create a structure for the collection. Open the Settings of the the Collection Form and specify where it should fetch the data from which collection and Save the changes.

DrapCode Builder Font Family

3. Create an Event

You need to create a simple event to make the call to fetch data from form to Xano or any third-party integration. Go to Events and choose Create Event. Name your event and click Create.

DrapCode Builder Font Family

3.1 Configure the Event to Save Data

In the event mention what it is supposed to do. Here in this case it you can choose the collection to save data as the first event.

DrapCode Builder Font Family

3.2 Add the Event Details

In the pop-up that opens select the collection in which you want to save data. Then you can mention an alert message and how you want to save it (this is optional). Then choose Save to finish. This will make the API call and store it in the collection.

DrapCode Builder Font Family

3.3 Configure the Event to Send Data

In the event mention what it is supposed to do. Here in this case it you can choose the external API and ask it to send data to the external API i.e., Xano in this case.

DrapCode Builder Font Family

3.4 Specify the Event Details

In the pop-up that opens select the external API you created. Then you can mention an alert message or how you want to save it. Then choose Save to finish. This will make the API call and store it in the collection.

DrapCode Builder Font Family

4. Bind the Event

Open the Form settings and mention the event to which you want to bind it to. This will save the data then send the data to the external API which will send it to Xano. Then Save your settings.

DrapCode Builder Font Family

5. Create a Project

Go to Preview and add details as per the fields in the form. Then click the Submit button. This action will save the data in the collection and send it to Xano or any other third-party integration and display the alert message for this action.

DrapCode Builder Font Family

6. Preview the Data

You can go to the Rest API or the collection and reload it. Your form data will appear in the collection as well as Xano. Similarly, you can add more records and have them pushed to the Xano while saving them in the collection.

DrapCode Builder Font Family