How can I write a Post Call code to display fetched results using a Get Call in Bubble?

This topic was automatically generated from Slack. You can find the original thread here.

, help me write a Post Call code to display the fetched results to bubble through the following Get Call

Get Call

// To use any npm package, just import it
import axios from “axios”

export default defineComponent({
async run({ steps, $ }) {
let id = ‘99558350-f8f7-43a0-acf8-2748a8e8d0c0’;
let config = {
method: ‘get’,
maxBodyLength: Infinity,
url:https://api.thymia.ai/v1/models/mental-wellness/${id},
headers: {
‘Content-Type’: ‘application/json’,
‘x-api-key’: ‘FBPKkHG20U9aMif0DxrznaYYE3g7qpJy97ZPoaHB’
},
};
console.log(config);
await axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
// Reference previous step data using the steps object and return data to use it in future steps
return steps.trigger.event
},
})

To help you write a POST call code to display the fetched results to Bubble through the provided GET call, I’ll create a Pipedream component that first makes the GET request, then makes a POST request to Bubble with the fetched results. Here’s the complete Pipedream component code: ```
import { axios } from “@pipedream/platform”; export default defineComponent({ props: { bubble: { type: “app”, app: “bubble”, }, }, async run({ steps, $ }) { // Define the GET request configuration let id = ‘99558350-f8f7-43a0-acf8-2748a8e8d0c0’; let getConfig = { method: ‘get’, maxBodyLength: Infinity, url: https://api.thymia.ai/v1/models/mental-wellness/${id}, headers: { ‘Content-Type’: ‘application/json’, ‘x-api-key’: ‘FBPKkHG20U9aMif0DxrznaYYE3g7qpJy97ZPoaHB’ }, }; // Make the GET request let getResponse; try { getResponse = await axios($, getConfig); console.log(“GET response data:”, getResponse); } catch (error) { console.error(“Error making GET request:”, error); throw error; } // Define the POST request configuration to Bubble let postConfig = { method: ‘post’, url: ${this.bubble.$auth.root_url}/your-endpoint, // Replace ‘your-endpoint’ with the actual endpoint headers: { ‘Authorization’: Bearer ${this.bubble.$auth.api_key}, ‘Content-Type’: ‘application/json’, }, data: getResponse, // Send the fetched data to Bubble }; // Make the POST request let postResponse; try { postResponse = await axios($, postConfig); console.log(“POST response data:”, postResponse); } catch (error) { console.error(“Error making POST request:”, error); throw error; } // Return the POST response data return postResponse; }, });

give it to me only for post request considering the get request shared with you