So I would like to expose a custom rest api endpoint in sales force to access and update by custom object.
My Apex Class looks like
@RestResource(urlMapping='/v1/gcxintegrateddata/*')
global with sharing class GCXIntegratedDataController {
@HttpGet
global static List<GCX_Integrated_Data__c> getList() {
// ... removed for brevity
return data;
}
}
I have a connected app that in a sandbox environment in lightning.force
https://xxxx.lightning.force.com
I can get an authentication token using postman but when i try to invoke my endpoint i always get an INVALID_SESSION_ID
Is there anything that I am missing?
This is what my request looks like
GET /services/apexrest/v1/gcxintegrateddata
cache-control: no-cache
postman-token: 4e638e44-8e8c-4397-846c-b285abbcd7d4
authorization: Bearer 00D6F000002TjRj!ARMAQJgUk7HgTzNhvBPVn59WwFYoMB19vEIPSLg1DMU24cmnEVJWnWeCcWuL5aBmUH7AM3Z9Cyuec.VFPhSAaC19Jx8ulEtJ
user-agent: PostmanRuntime/7.3.0
accept: */*
host: xxxx.salesforce.com
inst=APP_0k; 79eb100099b9a8bf=3:false:.salesforce.com
accept-encoding: gzip, deflate
HTTP/1.1 401
status: 401
date: Fri, 30 Nov 2018 05:37:56 GMT
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
content-security-policy: upgrade-insecure-requests
x-robots-tag: none
cache-control: private
www-authenticate: Token
content-type: application/json;charset=UTF-8
transfer-encoding: chunked
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]
Best Answer
Follow the below steps to get Authorization code using POSTMAN and make a callout: