Metadata V2 Set

The MetadataClosed Metadata provides information about a piece of data. It is used to summarize basic information about data, which can make working with the data easier. In the context of Keyfactor Command, the certificate metadata feature allows you to create custom metadata fields that allow you to tag certificates with tracking information about certificates. V2 Set POST method is used to set metadata value on a certificate in Keyfactor Command. The POST request body must consist of a JSON string containing the parameters used to set a certificate’s metadata. If the request is successful, a 200 OK will be returned with "true" in the message body. If it is not, an appropriate 4xx HTTP status code is returned, and the body will contain a JSON object with a message about the error.

Example Request

Using thumbprint

POST http://<host>/CMSApi/Metadata/2/Set

{
	"Key": "Thumbprint",
	"Thumbprint": "<thumbprint>",
	"metadatalist" : [{"EmailAddress":"bob.smith@example.com"}]
}

Example Request

Using serial

POST http://<host>/CMSApi/Metadata/2/Set HTTP/1.1

{
	"Key": "Serial",
	"SerialNumber": "<serial-number>",
	"SerialIssuer": "<issuing-ca>",
	"metadatalist": [{"EmailAddress": "bob.smith@example.com"}]
}

Example Response

(Unsuccessful)

{
	"Message": "The following metadata errors were found: 'myInvalidField' was not a valid 	MetadataFieldTypeName."
}