-
-
Notifications
You must be signed in to change notification settings - Fork 240
Support using a named credential for self-calling REST API endpoints in the current org #996
Copy link
Copy link
Open
Labels
Layer: ConfigurationItems related to the custom hierarchy setting LoggerSettings__c or any included custom metadata typeItems related to the custom hierarchy setting LoggerSettings__c or any included custom metadata typeLayer: Logger EngineItems related to the core logging engineItems related to the core logging engineLogging Source: APIItems related to using Nebula Logger via REST APIItems related to using Nebula Logger via REST APISalesforce Feature: SecurityItems related to the security model (object-level access, field-level security, record sharing)Items related to the security model (object-level access, field-level security, record sharing)Type: EnhancementNew feature or requestNew feature or request
Description
Metadata
Metadata
Assignees
Labels
Layer: ConfigurationItems related to the custom hierarchy setting LoggerSettings__c or any included custom metadata typeItems related to the custom hierarchy setting LoggerSettings__c or any included custom metadata typeLayer: Logger EngineItems related to the core logging engineItems related to the core logging engineLogging Source: APIItems related to using Nebula Logger via REST APIItems related to using Nebula Logger via REST APISalesforce Feature: SecurityItems related to the security model (object-level access, field-level security, record sharing)Items related to the security model (object-level access, field-level security, record sharing)Type: EnhancementNew feature or requestNew feature or request
Context
Currently, the save method
RESTcan be used to save logging data via a callout from & to the current org. This is (as far as I know) not a widely used option, but it can occasionally be helpful in situations where Apex code is already making callouts, so 1 more callout (to the org itself) can be better than worrying about errors likeYou have uncommitted work pending. Please commit or rollback before calling out.The current implementation just uses the value of
System.UserInfo.getSessionId()as theBearertoken in the REST call'sAuthorizationheader. This can be a problem for a few reasons:What
I'd like to provide a way for
Logger.RestApiSaverto use a named credential (withSystem.UserInfo.getSessionId()still as a fallback option). For now, this would only be used for saving via REST API - but there are some possible future enhancements that would benefit from being able to call the REST API (including some Tooling API endpoints), so introducing a named credential for Nebula Logger to use could be advantageous elsewhere too.How
One way to possibly handle this is with a new
LoggerParameter__mdtrecord, where admins can specify the name of aNamedCredentialto use when making callout.LoggerParameter__mdtrecord