This topic was automatically generated from Slack. You can find the original thread here.
i want to print the pipedream reposne in curl response si is it possible ? or i have to use just node ?
This topic was automatically generated from Slack. You can find the original thread here.
i want to print the pipedream reposne in curl response si is it possible ? or i have to use just node ?
Hello , to print the raw response you need to use a code step. Pipedream http action will extract the response body and headers and return them as the step result
thanks for the response … can you plz provide me the code step to extract or any link for that ?
You can use this example here:
// To use any npm package on Pipedream, just import it
import axios from "axios"
export default defineComponent({
async run({ steps, $ }) {
const response = await axios({
method: "GET",
url: "https://pokeapi.co/api/v2/pokemon/charizard",
})
// log the response
console.log('response', response)
return response.data
},
})
so this code i have to do it in pipedream or in my php page ?
you can read through the document here to understand how Pipedream code step works: Writing Node.js in Steps
ok thanks for the resposne let me try this
i have deployed the code statement in pipedream it gives me response in pipedream but anyhow its not giving response back in my curl code … it still gives me success message not response
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => ‘https://eo9z3vx372glhd0.m.pipedream.net’,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => ‘’,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => ‘POST’,
CURLOPT_POSTFIELDS =>‘{
“clientId”: “",
“clientSecret”: "*********”
}’,
CURLOPT_HTTPHEADER => array(
‘Content-Type: application/json’,
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
this is my curl code
// To use any npm package, just import it
import axios from “axios”
const data = {
clientId: “**********”,
clientSecret: ********"
};
axios.post(‘https://dev.abdm.gov.in/gateway/v0.5/sessions’, data)
.then((res) => {
console.log(Status: ${res.status}
);
console.log('Body: ', res.data);
return res.data
}).catch((err) => {
console.error(err);
*return err
});
this is node code
any luck for this ?
, now I’m not sure I understand your needs. Could you elaborate your usecase?
From my understanding, your Pipedream workflow has a webhook trigger, and your PHP code will call Pipedream webhook? Now you want to have the response of your Pipedream webhook in your phph server?
yes exactly
Okay , so what you need do are:
• Change your webhook trigger to use the custom response (1st image below)
• Then use the Return HTTP Response action (2nd and 3rd images below)
thanks leo … but the thing is instead actual response of the main api … i only got success true
actual api - https://dev.abdm.gov.in/gateway/v0.5/sessions
pipedream url : https://eo9z3vx372glhd0.m.pipedream.net
where will i post the api parameter like client id , secret