Is there an existing issue for this?
Description
I am trying to integrate Stripe REST API with Appsmith 2.1 to create a Quote using the /v1/quotes endpoint.
Stripe requires the request body to be sent as:
Content-Type: application/x-www-form-urlencoded
with nested parameters using bracket notation:
customer=cus_xxx
line_items[0][price]=price_xxx
line_items[0][quantity]=1
The request works correctly when I manually configure the Form URL Encoded fields inside the Appsmith REST API query editor.
However, I cannot dynamically generate the request body from a JavaScript object.
Example dynamic payload:
{
customer: "cus_UrSInvlqDVfVdz",
"line_items[0][price]": "price_1TtWzu7M0ZqS39f7MOhzp9Kv",
"line_items[0][quantity]": 1
}
When using the Form URL Encoded body editor manually, Stripe receives the request correctly and creates the quote.
However, when trying to pass a dynamic body using:
{{ this.params.payload }}
or using a Raw body with:
Appsmith does not send the body content.
The Appsmith request log shows:
{
"headers": {
"Content-Type": [
"application/x-www-form-urlencoded"
]
},
"body": ""
}
The same encoded payload works when entered manually in the Form URL Encoded editor:
customer=cus_UrSInvlqDVfVdz&line_items[0][price]=price_1TtWzu7M0ZqS39f7MOhzp9Kv&line_items[0][quantity]=1
This seems to be a limitation with dynamically generating application/x-www-form-urlencoded bodies in Appsmith 2.1.
I need a way to dynamically generate form-urlencoded fields because Stripe uses indexed parameters like:
line_items[0][price]
line_items[1][price]
line_items[2][price]
and the number of line items is dynamic.
Steps To Reproduce
## Steps To Reproduce
1. Create a REST API query in Appsmith 2.1.
2. Configure the query:
- Method: `POST`
- URL:
https://api.stripe.com/v1/quotes
Content-Type: application/x-www-form-urlencoded
3. Configure the body as `Form URL Encoded`.
4. Add the following fields manually:
| Key | Value |
|---|---|
| customer | cus_UrSInvlqDVfVdz |
| line_items[0][price] | price_1TtWzu7M0ZqS39f7MOhzp9Kv |
| line_items[0][quantity] | 1 |
5. Execute the query.
Result:
The Stripe API successfully creates the quote.
6. Create a JSObject that generates the payload dynamically:
```javascript
export default {
createPayload() {
return {
customer: "cus_UrSInvlqDVfVdz",
"line_items[0][price]": "price_1TtWzu7M0ZqS39f7MOhzp9Kv",
"line_items[0][quantity]": 1
};
}
}
- Call the query dynamically:
Stripe_CreateQuote.run({
payload: StripeService.createPayload()
});
- Try to use the dynamic payload in the query body:
{{ this.params.payload }}
-
Execute the query.
Result:
The request body is not sent correctly.
-
Try using the Raw body type instead:
Body:
Stripe_CreateQuote.run({
body: "customer=cus_UrSInvlqDVfVdz&line_items[0][price]=price_1TtWzu7M0ZqS39f7MOhzp9Kv&line_items[0][quantity]=1"
});
-
Execute the query.
Result:
The Appsmith request log shows an empty body:
Stripe receives no parameters and creates an empty quote.
- Expected behavior:
The dynamic payload should be sent exactly like the manually configured Form URL Encoded fields:
customer=cus_UrSInvlqDVfVdz&line_items[0][price]=price_1TtWzu7M0ZqS39f7MOhzp9Kv&line_items[0][quantity]=1
Public Sample App
No response
Environment
Production
Severity
Critical (Broken Production apps)
Issue video log
No response
Version
Self-hosted v2.1
Is there an existing issue for this?
Description
I am trying to integrate Stripe REST API with Appsmith 2.1 to create a Quote using the
/v1/quotesendpoint.Stripe requires the request body to be sent as:
with nested parameters using bracket notation:
The request works correctly when I manually configure the Form URL Encoded fields inside the Appsmith REST API query editor.
However, I cannot dynamically generate the request body from a JavaScript object.
Example dynamic payload:
When using the Form URL Encoded body editor manually, Stripe receives the request correctly and creates the quote.
However, when trying to pass a dynamic body using:
or using a Raw body with:
Appsmith does not send the body content.
The Appsmith request log shows:
{ "headers": { "Content-Type": [ "application/x-www-form-urlencoded" ] }, "body": "" }The same encoded payload works when entered manually in the Form URL Encoded editor:
This seems to be a limitation with dynamically generating
application/x-www-form-urlencodedbodies in Appsmith 2.1.I need a way to dynamically generate form-urlencoded fields because Stripe uses indexed parameters like:
and the number of line items is dynamic.
Steps To Reproduce
https://api.stripe.com/v1/quotes
Content-Type: application/x-www-form-urlencoded
Execute the query.
Result:
The request body is not sent correctly.
Try using the Raw body type instead:
Body:
Execute the query.
Result:
The Appsmith request log shows an empty body:
{ "body": "" }Public Sample App
No response
Environment
Production
Severity
Critical (Broken Production apps)
Issue video log
No response
Version
Self-hosted v2.1