1

Below is my code

@RestResource(urlMapping='/v1/accounts/*')
global with sharing class REST_AccountService_V1 {
@HttpGet
global static Account doGet() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Account result = [SELECT Id, Name, Phone, Website, BillingState FROM Account WHERE External_Id__c = :accountId];
return result;
}
}

When I try to test the above Rest service in SOAPUI Tool I am getting an error as below:

[ERROR:]Service not found at: /services/apexrest/AccountRaw ResponseHTTP/1.1 404 Not Found Date: Fri, 30 Oct 2015 06:35:33 GMT Set-Cookie: BrowserId=-MDkUrODQ_K2MkY-SmGwqw;Path=/;Domain=.salesforce.com;Expires=Tue, 29-Dec-2015 06:35:33 GMT Expires: Thu, 01 Jan 1970 00:00:00 GMT Content-Type: application/json;charset=UTF-8 Transfer-Encoding: chunked
[ { "errorCode" : "NOT_FOUND", "message" : "Could not find a match for URL /Account" } ]

Do I need to create a Remote site URL also ?How does it help?

1 Answer 1

4

In your code, your urlMapping is '/v1/accounts/*' but you tried to hit /services/apexrest/AccountRaw. You should be using /services/apexrest/v1/accounts to hit or change your code's annotation to @RestResource(urlMapping='/AccountRaw/*')

You must log in to answer this question.

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