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
kosmitevkosmitev 

Cannot call APEX REST POST method which was working before

Hi,

I have the following APEX rest method:

 

@RestResource(urlMapping='/TestService/*')
global with sharing class TestService {
@HttpPost
global static String Scheduler() {
     return 'TEST';
}

}

 

When I try to call it with:

curl -X POST -H "X-PrettyPrint:1" -H "Content-Type:application/x-www-form-urlencoded" -k "https://na12-api.salesforce.com/services/apexrest/TestService/Scheduler?schedule=1&hour=22&minute=48" -H "Authorization: Bearer SESSION_ID"

It returns the following error message:

[ {
"message" : "An unexpected error occurred. Please include this ErrorId if you
contact support: 330346244-51980 (863387990)",
"errorCode" : "UNKNOWN_EXCEPTION"
} ]

 

when I change ti to @HttpGet and I call it with curl -X GET -H "X-PrettyPrint:1" -H "Content-Type:application/x-www-form-urlencoded" -k "https://na12-api.salesforce.com/services/apexrest/TestService/Scheduler?schedule=1&hour=22&minute=48" -H "Authorization: Bearer SESSION_ID"

 

I get the expected result.

 

Any help will be appreciated.

 

Thanks,

Kzmp