Newer Version Available

This content describes an older version of this product. View Latest

describeMetadata()

This call retrieves the metadata which 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 components.

Syntax

1DescribeMetadataResult = metadataConnection.describeMetadata(double apiVersion);

Arguments

Name Type Description
apiVersion double The API version for which you want metadata; for example, 33.0.

Permissions

Your client application must be logged in with the “Modify All Data” permission.

Sample Code—Java

1swfobject.registerObject("clippy.codeblock-1", "9");public 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}
24