5

I am trying to test my code from workbench by sending an xml file to my @restresource global class. I have a @httpPost method through which I wan to insert the record. When I try to send a request to my class I am getting error : URL not found My class code

@RestResource(urlMapping='/Lead')
global with sharing class ParentRest {
@HttpPost
global static Lead doPost() {
    RestRequest req = RestContext.request;
    system.debug('The request ' + req);
    return null;
}
}

My workbench Url

/services/apexrest/lead

Workbench header

Content-Type: application/XML; charset=UTF-8
Accept: */*

Error on workbench:

 [ {
 "errorCode" : "NOT_FOUND",
 "message" : "Could not find a match for URL /lead"
 } ]

What will be the reason. Anyone have any idea what will be the reason? Please guide me how to solve this issue.

8

I have solved the issue. Solution: If you have namespace defined in salesforce you need to define it with /services/apexrest/namespace/lead

  • This was my exact issue. Thank you very much for this! – Genko Jun 1 '17 at 5:38
  • Yeah Now I got the solution :) – dinesh Jun 15 '18 at 13:28

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.