• karuna sunkara
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi,

I have a created a Apex class as follows.

@RestResource(urlMapping='/showAccounts/*')
global class KarunaRESTController1
{

@HttpGet
global static LIST<Account> getAccounts()
{
List<Account> lst;
try
{

RestRequest req = RestContext.request;
String NameValue = req.params.get('name');
lst = [select name, AccountSource from Account where name=:NameValue LIMIT 100];
}
catch(Exception e)
{
system.debug('ERROR:'+e.getMessage());
}
return lst;
}
}


After successfully saving the class, when I try to invoke the url in the chorme- Rest Client, I am alwasy getting the Invalid session ID, even I pass the valid session. can you please share me how can I access my custom api.

https://na17.salesforce.com/services/apexrest/showAccounts

by passing authorization header as oauth. tried with oauth / bearer. none of them working.
Hi,

I have a created a Apex class as follows.

@RestResource(urlMapping='/showAccounts/*')
global class KarunaRESTController1
{

@HttpGet
global static LIST<Account> getAccounts()
{
List<Account> lst;
try
{

RestRequest req = RestContext.request;
String NameValue = req.params.get('name');
lst = [select name, AccountSource from Account where name=:NameValue LIMIT 100];
}
catch(Exception e)
{
system.debug('ERROR:'+e.getMessage());
}
return lst;
}
}


After successfully saving the class, when I try to invoke the url in the chorme- Rest Client, I am alwasy getting the Invalid session ID, even I pass the valid session. can you please share me how can I access my custom api.

https://na17.salesforce.com/services/apexrest/showAccounts

by passing authorization header as oauth. tried with oauth / bearer. none of them working.