12.07.2015 Views

Database.com Metadata API Developer's Guide - Salesforce.com

Database.com Metadata API Developer's Guide - Salesforce.com

Database.com Metadata API Developer's Guide - Salesforce.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Utility Callsdescribe<strong>Metadata</strong>()describe<strong>Metadata</strong>()This call retrieves the metadata which describes your organization. This information includes Apex classes and triggers, customobjects, custom fields on standard objects, tab sets that define an app, and many other <strong>com</strong>ponents.SyntaxDescribe<strong>Metadata</strong>Result[] = metadataConnection.describe<strong>Metadata</strong>(double apiVersion);ArgumentsNameapiVersionTypedoubleDescriptionThe <strong>API</strong> version for which you want metadata; for example, 30.0.PermissionsYour client application must be logged in with the “Modify All Data” permission.Sample Code—Javapublic void describe<strong>Metadata</strong>() {try {double apiVersion = 21.0;// Assuming that the SOAP binding has already been established.Describe<strong>Metadata</strong>Result res =metadataConnection.describe<strong>Metadata</strong>(apiVersion);StringBuffer sb = new StringBuffer();if (res != null && res.get<strong>Metadata</strong>Objects().length > 0) {for (Describe<strong>Metadata</strong>Object obj : res.get<strong>Metadata</strong>Objects()) {sb.append("***************************************************\n");sb.append("XMLName: " + obj.getXmlName() + "\n");sb.append("DirName: " + obj.getDirectoryName() + "\n");sb.append("Suffix: " + obj.getSuffix() + "\n");sb.append("***************************************************\n");}} else {sb.append("Failed to obtain metadata types.");}System.out.println(sb.toString());} catch (ConnectionException ce) {ce.printStackTrace();}}ResponseDescribe<strong>Metadata</strong>Resultlist<strong>Metadata</strong>()This call retrieves property information about metadata <strong>com</strong>ponents in your organization. Data is returned for the <strong>com</strong>ponentsthat match the criteria specified in the queries parameter. The queries array can contain up to three List<strong>Metadata</strong>Queryqueries for each call. This call supports every metadata type: both top-level, such as CustomObject and ApexClass, and childtypes, such as CustomField.56

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!