Create an access token for Preference Manager forms by using REST API.
Required Editions
After you generate the access token, append the access token string ?pctoken=[token string] to the website URL of your published site. Then send this URL to your users to give them access to the preference form without logging in.
| Available in: Developer, Enterprise, Performance, and Unlimited Editions. Requires the Salesforce Privacy Center license. |
| User Permissions Needed | |
|---|---|
| To use the Preference Manager Builder: | ManagePreferenceManager |
Syntax
| URI | services/data/vXX.X/consent/prefcenter/token |
| Formats | JSON |
| HTTP Methods | POST |
| Authentication | Bearer Token |
| Request Parameters | recordId |
| Request Body |
The request body contains a JSON object with the record ID of the associated object.
|
| Response Body |
The response body returns a JSON object containing the token for the user associated with the provided recordId.
|
Example Response Body
This example shows a successful response for a request with the record ID 0034L00000CZqeqQAD.
{
"success" : true,
"tokenMapping" :
{
"token": "QTRMMDAwMDAwNTRQSGc0ZlhSczZnSXNTNEpNUVBldWN6
cFl0bDRNcERURWRMWGJPZ1hhamxQTnUxa2oxN0dXVVFM
alhwNFY1NXVxaDlrcXEwcFhuQy94WGNBYmMyMkZaWjJR
L1VTOWw0UVhiZ2s4dFZaMUM0M053M01wWllUUTQzODZ1
VjFLekxod2xQZ2NNQzRIYzNuM2RtRW9kVTRTN1lEdz09"
},
"tokenErrors": {},
"error": ""
}