Skip to main content
7 events
when toggle format what by license comment
Oct 2, 2020 at 22:11 comment added user88797 Can you elaborate on what I'm checking specifically? My Named Credential is hooked up to an Authentication Provider that I set up for it and I did everything pretty standard based on tutorials.
Oct 2, 2020 at 20:58 comment added sfdcfox @user88797 Because you're reaching the base login URL. If your session is invalid, check your OAuth settings on your Named Credential. You need to make sure you're connected.
Oct 2, 2020 at 19:22 comment added user88797 Hi sfdcfox, In my target orgs RestResource class I defined it as just this: "@RestResource(urlMapping='/Opportunity/*')" but when I change my endpoint to "request.setEndpoint('callout:HS_Integration/services/apexrest/Opportunity');" I get this error: "14:21:46:327 USER_DEBUG [38]|DEBUG|[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]" But when I omit everything after HS_integration I get a successful HTTP code. any idea why?
Oct 2, 2020 at 17:16 comment added sfdcfox @user88797 It would be callout:HS_Integration/services/apexrest/urlFragment (where urlFragment is the urlResource='/urlFragment' in the RestResource annotation). P.S. Why not just use the normal Salesforce REST API at this point?
Oct 2, 2020 at 15:02 comment added user88797 I'm starting to think the issue isn't with my body but with my named credential. Right now my credential URL is 'myorg.salesforce.com' and my callout is directly to that, but do I need to append something to my request.setEndpoint() to point directly to the Opportunity service? I've tried request.setEndpoint('callout:HS_Integration/services/apexrest'); but that didn't work either, I got an invalid session error. clearly I am connected to my target org in some way but maybe I am not pointing to the opportunity services. Any idea?
Oct 2, 2020 at 13:56 comment added user88797 Thanks, I tried your code snippet instead of what I had for the body and I still am getting a 200 return code but I am not seeing the opportunity created in my org. If that json body is in the right format do you have any other ideas on what could be missing?
Oct 1, 2020 at 21:27 history answered sfdcfox CC BY-SA 4.0