You need to sign in to do that
Don't have an account?

Session expired or invalid session when Rest API run on postman client
Hi ,
I was created rest api class below...
@RestResource(urlMapping='/sample controller/*')
global with sharing class RESTController {
@HttpGet
global static List<Campaign> getContacts() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String contactId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
try{
list<Campaign> camp = [SELECT id,parentid,name,program_grade_level__c,council_code__c,account__C FROM campaign WHERE id IN (SELECT campaignid from campaignmember where contactid=: contactId and active__c = true) AND job_code__c = 'DP' and Program_Grade_Level__c IN ('1-Daisy','2-Brownie','3-Junior')];
return camp;
}Catch(exception e){
return null;
}
}
}
when i am testing class through postman client getting error Session expired or invalid session.
Can help me how to solve this please.
I was created rest api class below...
@RestResource(urlMapping='/sample controller/*')
global with sharing class RESTController {
@HttpGet
global static List<Campaign> getContacts() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String contactId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
try{
list<Campaign> camp = [SELECT id,parentid,name,program_grade_level__c,council_code__c,account__C FROM campaign WHERE id IN (SELECT campaignid from campaignmember where contactid=: contactId and active__c = true) AND job_code__c = 'DP' and Program_Grade_Level__c IN ('1-Daisy','2-Brownie','3-Junior')];
return camp;
}Catch(exception e){
return null;
}
}
}
when i am testing class through postman client getting error Session expired or invalid session.
Can help me how to solve this please.
Essentially, make sure you have an oAuth Access token and be sure to put it into the request headers.