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; }, });