Hi There!
I’m Getting Error while Sending an API Request even after Sending same Request in Postman in Which I got Correct Response
Please Help
Postman Request:
Blocks:
Error Response:
Thanks, whoocoder
Hi There!
I’m Getting Error while Sending an API Request even after Sending same Request in Postman in Which I got Correct Response
Please Help
Postman Request:
Thanks, whoocoder
Try removing the “generate JSON from object” from the Web_API Body block.
Hi Steve!
I removed generate JSON block from Body o Web API but No Response was Being Shown.
Change your content type to application/json in the header
Format it as a proper Json object using list blocks with nested objects
Can you Please send me the Bolcks so that I can Format the Body in List Format??
No
Please try first. At least show that you’re putting forth the effort to implement my feedback.
Post a new block example where you try to interpret what I meant.
Additionally, if you need that key to be private, you should do this call from a backend server. While you can do it from the client doesn’t make it a best or even safe practice.
Just something to think about
In Postman, you are sending in the x-www-form-urlencoded method in thunkable you are sending in JSON format. So just like @jared mentioned, set your Content-Type
header to application/json
. If it still doesn’t work then try adding these headers:
-H 'Accept-Encoding:gzip,deflate,br'
-h 'Accept:*/*'
Still error
Try setting the content-type
header to x-www-form-urlencoded
again, Set Accept
to */*
. If it still doesn’t work try removing some headers except content-type
Still Error
[
pleaes show more of your blocks here
all of the api blocks, preferably
URL
body
query
headers
Check this related solution from @muneer
nice!
yeah, i always forget that the x-www-form-urlencoded needs to go in the body as text
Sorry but glad you got it working! you should share a screenshot or screen recording of the api call in xano for others to see the solution!
Hi Jared!
Sorry for the Late Reply
Response:
{
request: {
url: https://api.stripe.com/v1/checkout/sessions,
method: POST,
headers: [
POST /v1/checkout/sessions HTTP/2,
Host: api.stripe.com,
accept-encoding: gzip, deflate,
authorization: Basic API KEY,
content-type: application/x-www-form-urlencoded,
accept: application/json,
content-length: 214],
params: {
success_url: https://thunkable.site/w/********************,
line_items[0][price]: price_*****************************,
line_items[0][quantity]: 1,
mode: subscription,
discounts[][coupon: sq***********}},
response: {
headers: [
HTTP/2 200,
server: nginx,
date: Mon, 30 Oct 2023 02:08:46 GMT,
content-type: application/json,
content-length: 2099,
access-control-allow-credentials: true,
access-control-allow-methods: GET,HEAD,PUT,PATCH,POST,DELETE,
access-control-allow-origin: *,
access-control-expose-headers: Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, X-Stripe-Privileged-Session-Required,
access-control-max-age: 300,
... +10 more
],
result: {
id: cs_live_****************************************************************************,
object: checkout.session,
after_expiration: null,
allow_promotion_codes: null,
amount_subtotal: ******,
amount_total: *****,
automatic_tax: {
enabled: false,
status: null},
billing_address_collection: null,
cancel_url: null,
client_reference_id: null,
client_secret: null,
consent: null,
consent_collection: null,
created: ********,
currency: inr,
currency_conversion: null,
custom_fields: [],
custom_text: {
shipping_address: null,
submit: null,
terms_of_service_acceptance: null},
customer: null,
customer_creation: always,
customer_details: null,
customer_email: null,
expires_at: &****&****,
invoice: null,
invoice_creation: null,
livemode: true,
locale: null,
metadata: {},
mode: subscription,
payment_intent: null,
payment_link: null,
payment_method_collection: always,
payment_method_configuration_details: {
id: pmc_**********************************************,
parent: null},
payment_method_options: null,
payment_method_types: [
card],
payment_status: unpaid,
phone_number_collection: {
enabled: false},
recovered_from: null,
setup_intent: null,
shipping_address_collection: null,
shipping_cost: null,
shipping_details: null,
shipping_options: [],
status: open,
submit_type: null,
subscription: null,
success_url: https://thunkable.site/w/***************************************,
total_details: {
amount_discount: *******************,
amount_shipping: 0,
amount_tax: 0},
ui_mode: hosted,
url: https://checkout.stripe.com/c/pay/cs_live_*********************************************************************************************************************************************************************************************************************************************************************************************************************************************************},
status: 200}}
nice work!!