0

I need to capture data locally as well as submit that data to Salesforce. I am trying to POST data to https://[example].secure.force.com/HC4__WebFormProcessor , however I am getting a response of 401: Unauthorized.

The web-to-lead forms are standard HTML 5 forms with no authorization. If I place the <form action="https://[example].secure.force.com/HC4__WebFormProcessor" method="post"> <!-- Form Fields Here --></form> and open the file locally it submits without problem as there is no authentication going on. No OAuth, no tokens, no secrets, it's just a simple POST to the API and works fine as HTML, but not when mocked in Postman. I've also tried doing a POST using C#'s WebClient but am getting the same error.

I've tried with the Content-Type set to x-www-form-urlencoded (the expected type) as well as form-data (just in case).

This is something I've done almost a hundred times for various API endpoints, including other web-to-lead Salesforce endpoints for other clients! I've been unable to find any information from Salesforce on why this is an issue. I've contacted Salesforce help to no avail.

I'd like to also preface this with I am not familiar with Salesforce and my only interactions with them are spinning up WebClients to POST data to their API endpoints, so if using terminology specific to Salesforce please try to be a bit more general or explain in their Dashboard where I might find the information. I'm not even sure this is 100% web-to-lead but it is what I've heard it being called by the support rep.

  • Please provide actual HTTP requests/responses in both Postman and non-Postman cases. – identigral May 22 at 17:40
  • The raw response is just an HTML error page telling me to login or register: pastebin.com/Y1CiHsei The POST in Postman: i.vgy.me/N59ibV.png The non-Postman response and requests are 100% the same, just the POST is done using C#'s WebClient. – DesperateDeveloper May 22 at 20:46
0

To avoid being DenverCoder9, I've come back to provide the answer. It took an embarrassing amount of time to discover that DemandConnectForm needed to be DemandConnect.Form. A very small and easy to miss typo that returns a completely irrelevant error message.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.