You need to sign in to do that
Don't have an account?
Amit Jain 109
[{"message":"invalid query locator","errorCode":"INVALID_QUERY_LOCATOR"}]
I have created a REST Webservice
@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource {
@HttpDelete
global static void doDelete() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Account account = [SELECT Id FROM Account WHERE Id = :accountId];
delete account;
}
@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 FROM Account WHERE Id = :accountId];
return result;
}
@HttpPost
global static String doPost(String name,
String phone, String website) {
Account account = new Account();
account.Name = name;
account.phone = phone;
account.website = website;
insert account;
return account.Id;
}
}
Now from Postman when I try to invoke the same using the below
https://na30.salesforce.com/services/data/v31.0/query/Account/0013600000OrUqm
I get the below error
[{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]
Can someone please help me to understand if there is any issue with the URL
@RestResource(urlMapping='/Account/*')
global with sharing class MyRestResource {
@HttpDelete
global static void doDelete() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Account account = [SELECT Id FROM Account WHERE Id = :accountId];
delete account;
}
@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 FROM Account WHERE Id = :accountId];
return result;
}
@HttpPost
global static String doPost(String name,
String phone, String website) {
Account account = new Account();
account.Name = name;
account.phone = phone;
account.website = website;
insert account;
return account.Id;
}
}
Now from Postman when I try to invoke the same using the below
https://na30.salesforce.com/services/data/v31.0/query/Account/0013600000OrUqm
I get the below error
[{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}]
Can someone please help me to understand if there is any issue with the URL
https://na30.salesforce.com/services/apexrest/Account/0013600000OrUqm
It worked for me....
Amit Jain