Skip to main content
added 52 characters in body
Source Link
Uwe Heim
  • 28.5k
  • 20
  • 121
  • 287

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; } }

@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" } ]

[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?

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?

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?

Source Link
Rann
  • 353
  • 1
  • 4
  • 11

Error while implementing a REST Service

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?