Skip to Content
0
Oct 05, 2022 at 03:41 PM

UI card unable to POST data to backend

195 Views

Hi all,

Has anyone successfully created a UI card that can POST data? For example C4C.

I can make GET requests fine, but when I attempt a POST request I get a 401 unauthorized error.

My Action Handler can be found below:

           "actionHandlers": {
                "submit": {
                    "url": "{{destinations.C4C}}/sap/c4c/odata/v1/c4codataapi/ServiceRequestCollection",
                    "method": "POST",
                    "withCredentials": true,
                    "headers" : {
                        "content-type" : "application/json"
                    },
                    "parameters": {
                        "Name" : "{form>/title}",
                        "ReportedForPartyID" : "80000062",
                        "ServiceIssueCategoryID" : "CA_63",
                        "ServiceRequestTextCollection": [
                            {
                              "Text": "Nathan is doing a test - {form>/description}", 
                              "TypeCode": "10004"
                            }
                        ]
                    }
                }
            }

The destination uses a technical user that I know works because I can complete a POST request using Postman without issue.

Any insights into sending data to the backend be it C4C or SF would be appreciated.

Many thanks,