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
Dejan CvetkoskiDejan Cvetkoski 

Restfull Api

Anyone help me. I send json object with webhook to  /services/apexrest/myService/test, but i can't reseve them, my class is 
@RestResource(urlMapping='/myService/test/*')
global class myWeb {
	 @HttpGet
    global static void sayHello() {
        RestRequest request = RestContext.request; 
        RestResponse response = RestContext.response;
        String accountId = request.requestURI.substring(request.requestURI.lastIndexOf('/')+1);
        System.debug(accountId);
    }
}

But result after execute is System.NullPointerException: Attempt to de-reference a null object. I need send from woocommerce wordpress plugin with webhooks to salesforce. Anyone help me. Thanks :)
Hargobind_SinghHargobind_Singh
Hi, can you post the example of how are you sending the jSON object, i.e., your URL ?
You might also want to consider getparameter function to get the parameter, rather than requestURI substring ?
 
Dejan CvetkoskiDejan Cvetkoski
I send from woocommerce (plugin for wordpress). 
User-added imageUser-added image
Dejan CvetkoskiDejan Cvetkoski
User-added image