Need Help with API POST Request in MIT AI Companion App

Hello everyone, this is my first post on this forum, and I would really appreciate any help with my issue.

I am developing an app that retrieves data from a public API. This API requires a POST request with a header containing a token in order to return a JSON response with the necessary information.

My problem is that whenever I create a block structure with a header and a body (see image 1), I always get the same error (see image 2 - using the AI Companion Android app).

I’m not sure if I’m structuring the blocks incorrectly or if there's an issue with the code. I need help figuring this out.

Also, here is a test I ran with Reqbin, showing the correct header and body needed for the request to be processed successfully:
https://reqbin.com/eylk5b1j

Thanks in advance!


Try headers like so:

You probably want just json / dictionary for your POSTText as well (no list blocks)

Thanks for your reply.

Actually, I had already tried that before, but I still get the same error inside Companion.

I also tried sending an incomplete header and no "body" to force an error response from the API and display it in the "Label," but the error comes from Companion itself.

It seems like the request is not being sent at all.

As @TIMAI2 suggested and try this text string in the PostText method

{
    "statusMessage": null,
    "model": {
        "transferDetails": {
            "selections": {
                "countryTo": "DO",
                "stateTo": null,
                "currencyTo": "DOP",
                "currencyFrom": "EUR",
                "paymentMethod": "DebitCard",
                "deliveryMethod": "OfficePickup",
                "amountFrom": 100.0,
                "amountTo": null,
                "agentToId": null,
                "agentToLocationId": null,
                "promoCode": null,
                "promoId": 0,
                "transferReason": null,
                "shouldCalcAmountFrom": false,
                "shouldCalcVariableRates": false,
                "countryFrom": null
            },
            "calculations": {
                "amountTo": 6413.0800,
                "amountFrom": 100.0,
                "promoAmount": 0.0,
                "totalFeesAndTaxes": 2.99,
                "totalAmount": 102.99,
                "totalAmountUSD": 107.79,
                "exchangeRate": 64.0,
                "isBestRate": false,
                "transferFee": 2.99,
                "originalCustomerFee": 0.0,
                "isAmountFromValid": null,
                "sendAmountLimit": {
                    "minimumSendFromAmount": 1.0,
                    "maximumSendFromAmount": 10000.0000,
                    "minimumSendToAmount": 64.0,
                    "maximumSendToAmount": 641309.0,
                    "showInlineError": true
                },
                "decimalPrecision": 2,
                "taxAmount": 0.0,
                "isPromoValid": false,
                "isReceiveAmountSplit": false,
                "splitExchangeRate1": null,
                "splitReceiveAmount1": 0.0,
                "splitCurrency1": null,
                "splitExchangeRate2": null,
                "splitReceiveAmount2": 0.0,
                "splitCurrency2": null,
                "variableRates": [{
                    "value": "OfficePickup",
                    "exchangeRate": 64.0,
                    "payAgentName": "",
                    "payAgentId": 0,
                    "isBestRate": false
                }, {
                    "value": "BankDeposit",
                    "exchangeRate": 64.0,
                    "payAgentName": "",
                    "payAgentId": 0,
                    "isBestRate": false
                }, {
                    "value": "HomeDelivery",
                    "exchangeRate": 64.0,
                    "payAgentName": "",
                    "payAgentId": 0,
                    "isBestRate": false
                }, {
                    "value": "MobilePayment",
                    "exchangeRate": 64.1,
                    "payAgentName": "Billet Mobile Wallet (BHD)",
                    "payAgentId": 18994511,
                    "isBestRate": true
                }],
                "sendAmountUSD": 104.66,
                "transferFeeUSD": 3.13,
                "correspondentPayoutFeeCurrency": null,
                "correspondentPayoutFeeAmount": 0.0,
                "estimatedAmountToAfterCorrespondentFees": 0.0,
                "payAgentId": 0,
                "payAgentName": "",
                "exchangeRatePromo": 64.13082512,
                "calculatedRatePromo": 64.13082512
            },
            "transferOptions": {
                "countries": null,
                "currencies": [{
                    "currencyCode": "DOP",
                    "isDefaultCurrency": true
                }, {
                    "currencyCode": "USD",
                    "isDefaultCurrency": false
                }],
                "paymentMethods": [{
                    "value": "CreditCard",
                    "text": "Credit card"
                }, {
                    "value": "DebitCard",
                    "text": "Debit card"
                }, {
                    "value": "DirectBank",
                    "text": "Direct bank"
                }],
                "deliveryMethods": [{
                    "value": "OfficePickup",
                    "text": "Cash pickup"
                }, {
                    "value": "HomeDelivery",
                    "text": "Home delivery"
                }, {
                    "value": "BankDeposit",
                    "text": "Bank"
                }, {
                    "value": "MobilePayment",
                    "text": "Mobile wallet"
                }]
            },
            "sessionId": null
        },
        "recipient": {
            "recipients": null,
            "id": null
        },
        "validationStatus": []
    },
    "formData": null,
    "contentModels": null,
    "errorResponse": {
        "errors": []
    },
    "profileStatus": null,
    "action": null,
    "actionValue": null,
    "beneficiaryBanks": null,
    "bankAccountFormatDropdown": null,
    "isMobileWalletAccountNumberFreeText": false,
    "isMobileWalletCountryCodeRemove": false,
    "isMobileWalletZeroPrefix": false
}

Taifun