Let us know so we can improve!
The online Trailblazer Community is now read-only. [Read the FAQ] [Get Help]
This call retrieves the metadata that describes your organization. This information includes Apex classes and triggers, custom objects, custom fields on standard objects, tab sets that define an app, and many other metadata types.
1DescribeMetadataResult = metadataConnection.describeMetadata(double apiVersion);Your client application must be logged in with the Modify Metadata Through Metadata API Functions or Modify All Data permission.
If a user requires access to metadata but not to data, enable the Modify Metadata Through Metadata API Functions permission. Otherwise, enable the Modify All Data permission.
Note
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}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.