Skip to content

Instantly share code, notes, and snippets.

@sfdcale
Last active June 24, 2024 16:54
Show Gist options
  • Select an option

  • Save sfdcale/71ada8a4cf1598a59b6b504de0b24579 to your computer and use it in GitHub Desktop.

Select an option

Save sfdcale/71ada8a4cf1598a59b6b504de0b24579 to your computer and use it in GitHub Desktop.
How to create External Credentials

Step 1:

Make POST call to endpoint (/services/data/v58.0/named-credentials/external-credentials/) with below JSON body to create external credential.

{
  "authenticationProtocol": "Custom",
  "customHeaders": [],
  "developerName": "Test2",
  "masterLabel": "Test",
  "parameters": [],
  "principals": [
    {
      "parameters": [],
      "principalName": "Test Principal",
      "principalType": "NamedPrincipal",
      "sequenceNumber": 1
    }
  ]
}

The above step creates external credential as below:

screenshot1 screenshot2 screenshot3

Step 2:

Make POST call to endpoint (/services/data/v58.0/named-credentials/credential/) with below JSON body to create external credential.

{
  "externalCredential": "Test2",
  "authenticationProtocol": "Custom",
  "principalName": "Test Principal",
  "principalType": "NamedPrincipal",
  "credentials": {
    "username": {
      "value": "00000000000",
      "encrypted": true
    }
  }
}

This creates a auth param named username under Test Principal

screenshot4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment