I have built an API that can read hard-coded JSON body data, but when I try to get it to read dynamic data, the API returns blank values. I have been trying to debug this forEVER. the API is running correctly. The workflow IS running. The data field ids DO match. The only thing I can think of is that the Bubble data just doesn’t translate to JSON. I have tried using the “formatted as JSON-safe” and still get empty responses.
So, for example, if the JSON body looks like this it works just fine:
{
“userId”: “test123”,
“projectionYears”: 5,
“accounts”: [
{
“accountId”: “test1”,
“accountName”: “Test Account”,
“accountType”: “depository”,
“currentBalance”: 5000,
“growthRate”: 2,
“interestRate”: 0,
“monthlyDeposit”: 500,
“monthlyPayment”: 0,
“userId”: “test123”
},
{
“accountId”: “test2”,
“accountName”: “Test Account” 2,
“accountType”: “credit”,
“currentBalance”: -500,
“growthRate”: 0,
“interestRate”: 18.5,
“monthlyDeposit”: 0,
“monthlyPayment”: 50,
“userId”: “test123”
}
]
}
BUT, if I try to use dynamic data like this:
{
“userId”: “test123”,
“projectionYears”: <Input Years into Future’s value:converted to number:default value 5>, “accounts”:
}
or like this:
{ “userId”: “test123”,
“projectionYears”: <Input Years into Future’s value:converted to number:default value 5>, “accounts”: [
{ “accountId”: <Search for Accounts_flats:first item’s accountId>,
“accountName”: <Search for Accounts_flats:first item’s accountName>,
“accountType”: <Search for Accounts_flats:first item’s accountType>,
“currentBalance”: <Search for Accounts_flats:first item’s currentBalance>,
“growthRate”: <Search for Accounts_flats:first item’s growthRate>,
“interestRate”: <Search for Accounts_flats:first item’s interestRate>,
“monthlyDeposit”: <Search for Accounts_flats:first item’s monthlyDeposit>,
“monthlyPayment”: <Search for Accounts_flats:first item’s monthlyPayment>,
“userId”: “test123”
}
]
}
I get empty data back from the API.
Here is a screenshot of one of my many attempts:
No red text or error message. The API runs and my results fields populate in my database. They just populate with empty cells. Lots and lots of empty results. YES, I have unchecked ‘private’ for all the keys.
