I'm looking at these three pieces of documentation:
- The ConnectApi.NamedCredentials class and specifically the
createCredentials
method - The ConnectApi.CredentialInput class that defines the argument for the
createCredentials
method - The Named Credential REST API that supports a POST so presumably can create a Named Credential and is probably what is wrapped by the above Apex classes
and do not see in any of them the ability to set a Label or Name (that can be set through the Setup UI).
What am I missing here?
PS
Trying an instanceof
reports:
Operation instanceof is always false since an instance of ConnectApi.CredentialInput is never an instance of ConnectApi.NamedCredential
and calling createCredentials
with a valid externalCredential
resulted in this message saying a UserExternalCredential
is being created which is not what I'm looking for (well I guess the method name and documentation are vague here):
ConnectApi.ConnectApiException: The UserExternalCredential object couldn't be saved because it's associated with an external credential with the following authentication protocol: Oauth