POST Metadata/SetPolicy

Assigns a Custom Field value to a policy.

Requirements

  • Permissions:  The caller must have Manage Policy permission to the Distinguished Name (DN) of policy in the request.
  • Token scope:  Configuration:Manage

Headers

  • Content type: Content-Type:application/json.

  • Token: The bearer access token that you received. For example, Authorization:Bearer 4MyGeneratedBearerTknz==. For more information, see Passing a bearer token in your API calls.

Parameters

Input parameters

Name

Description

DN

The Distinguished name (DN) of a policy folder that has values for at least one Custom Field. If necessary, use the DN value from the GET Metadata/Items or POST Metadata/GetItemsForClass response.

ConfigClass

The Device or X509 Certificate class.

Locked (optional)

Boolean indicating whether the value is to be locked by policy. If not specified, the value will not be locked by policy.

GuidData

An array of ItemGUID-List pairs. Each pair uniquely identifies a Custom Field and the value(s) to be assigned for the DN. To clear previously assigned values, leave the List empty.

  • ItemGuid: The GUID that identifies the Custom Field. To get the Custom Field GUID, use POST Metadata/GetItems. Depending on your environment, the GUID may be expressed with or without curly braces {}. For example, {3d6b61d-1c71-4603-883f-25b8c2ceecdd}.
  • List: An array of one or more Custom Field value changes. The value must match a Metadata Field Type. For example, to set a date, use the MM/DD/YYYY format.

Returns

Response description

Name

Description

Locked

The status of the data:

  • true: The Policy value, which applies to the Custom Field, is locked.
  • false: The Custom Field value is capable of change.

Result

The reason for success or failure. For more information, see Metadata Result Codes.

Example: Lock values on Certificate Policy

Request

POST https://tpp.venafi.example/vedsdk/Metadata/SetPolicy
Authorization:Bearer 4MyGeneratedBearerTknz==
{
   "DN": "\\VED\\Policy\\Certificates",
   "ConfigClass": "X509 Certificate",   
   "Locked": true,
   "GuidData": [
      { 
         "ItemGuid": "{a80714f0-565c-4bc2-9026-787cf076d764}",
         "List": ["XYZ789"]
      }
   ]
} 

Response

HTTP/1.1 200 OK
{
   "Locked": true,
   "Result": 0 
}