function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
My Salesforce 20My Salesforce 20 

Endpoint url for http post request

How to create endpoint url that allows clent to post the data.
I couldnt understand how to generate an url from salesforce that allows client to Post the Data
Team NubesEliteTeam NubesElite
Hi,
You still set up an ApexRest endpoint. There's nothing magic about it that requires JSON nor XML.
You can whip up a simple demo to prove ApexRest is sufficient for your needs:
@RestResource(UrlMapping='/Demo/*')
global class Demo
{
    @HttpPost
    global static void doStuff()
    {
        String body = RestContext.request.requestBody.toString();
        Map<String, String> params = new Map<String, String>();
        for (String param : body.split('&'))
        {
            if (param.contains('='))
            {
                params.put(param.substringBefore('=').trim(), param.substringAfter('=').trim());
            }
        }
        system.debug(JSON.serialize(params));
    }
}
Then post your payload to that endpoint. I used workbench and got exactly the expected results.



Thank You
www.nubeselite.com

Developement | Training | Consulting

Please mark this as solution if your problem resolved.