Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
describeMetadata()
Syntax
1DescribeMetadataResult = metadataConnection.describeMetadata(double apiVersion);Arguments
| Name | Type | Description |
|---|---|---|
| apiVersion | double | The API version for which you want metadata, for example, 67.0. |
Permissions
Your client application must be logged in with the Modify Metadata Through Metadata API Functions or Modify All Data permission.
Sample Code—Java
1public void describeMetadata() {
2 try {
3 double apiVersion = 21.0;
4 // Assuming that the SOAP binding has already been established.
5 DescribeMetadataResult res =
6 metadataConnection.describeMetadata(apiVersion);
7 StringBuffer sb = new StringBuffer();
8 if (res != null && res.getMetadataObjects().length > 0) {
9 for (DescribeMetadataObject obj : res.getMetadataObjects()) {
10 sb.append("***************************************************\n");
11 sb.append("XMLName: " + obj.getXmlName() + "\n");
12 sb.append("DirName: " + obj.getDirectoryName() + "\n");
13 sb.append("Suffix: " + obj.getSuffix() + "\n");
14 sb.append("***************************************************\n");
15 }
16 } else {
17 sb.append("Failed to obtain metadata types.");
18 }
19 System.out.println(sb.toString());
20 } catch (ConnectionException ce) {
21 ce.printStackTrace();
22 }
23}Response
When to Use describeMetadata() and describeValueType()?
Use the describeMetadata() call to get high-level information about all the metadata types that are available for your organization, such as type names and file suffixes. Use the describeValueType() call to get granular information about a specific metadata type, such as fields contained within the type.