curl --location --request POST 'https://us-central1-appgregator.cloudfunctions.net/stripe/products?name=ft-4&connection_name=stripe-1' \
--header 'x-api-key: XXX' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'name=sepatu adidas' \
--data-urlencode 'active=true' \
--data-urlencode 'description=sepatu olahraga' \
--data-urlencode 'id=012'
var axios = require('axios');
var qs = require('qs');
var data = qs.stringify({
'name': 'sepatu adidas',
'active': 'true',
'description': 'sepatu olahraga',
'id': '012'
});
var config = {
method: 'post',
url: 'https://us-central1-appgregator.cloudfunctions.net/stripe/products?name=ft-4&connection_name=stripe-1',
headers: {
'x-api-key': 'XXX',
'Content-Type': 'application/x-www-form-urlencoded'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://us-central1-appgregator.cloudfunctions.net/stripe/products?name=ft-4&connection_name=stripe-1',
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 => 'name=sepatu%20adidas&active=true&description=sepatu%20olahraga&id=012',
CURLOPT_HTTPHEADER => array(
'x-api-key: XXX',
'Content-Type: application/x-www-form-urlencoded'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;