I am unable to retrieve the Certificates of an org using the Financial Force Metadata API Apex Wrapper although I see the object in the Metadata API Documentation and can query it using the workbench.
When I call:
MetadataService.MetadataPort service = new MetadataService.MetadataPort();
service.SessionHeader = new MetadataService.SessionHeader_element();
service.SessionHeader.sessionId = UserInfo.getSessionId();
MetadataService.ListMetadataQuery query = new MetadataService.ListMetadataQuery();
query.type_x = 'Certificate';
for(MetadataService.FileProperties prop : service.listMetadata(new List<MetadataService.ListMetadataQuery>{ query }, 25)) {
System.debug(prop.fullName);
}
I get:
Line: 13524, Column: 1 System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: INVALID_TYPE: Cannot use: Certificate in this version faultcode=sf:INVALID_TYPE faultactor=
I also tried "certs", "cert", "certificates" for query.type_x
.
Note: this is breaking down my issues of Create Certificate/SSO Config in Apex using Metadata API into multiple questions as I didn't get any helpful feedback there.