10

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.

1 Answer 1

13

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

2
  • This was my exact issue. Thank you very much for this!
    – Genko
    Jun 1, 2017 at 5:38
  • Yeah Now I got the solution :)
    – SFDC
    Jun 15, 2018 at 13:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .