What Do You Know About Metadata API?

The Metadata API from Salesforce allows for the performance of many org setup and configuration features programmatically. You can use the API to deploy, retrieve, create, delete, or update customization info like page layouts and custom object definitions for your org. If you are using Salesforce cloud-based and online platforms like Force.com, Salesforce1, Work.com, Data.com, Desk.com, Do.com, and Site.com, Salesforce Ideas, and App Exchange, you will interact with Metadata API as you move data across them and it is, therefore, important that you understand what it involves.

What Is Metadata API Used For?

Metadata API allows you manage the customization and setup information (Metadata) for your organization. You can perform such tasks as:

  • Exporting customizations as XML Metadata files
  • Migrating configuration changes between different orgs
  • Modifying existing customizations in the org using XML Metadata files
  • Programmatically managing customizations in your org
  • Modifying Metadata in test orgs on sandbox org or Developer Edition, and then deploying the tested changes to production orgs either on Performance, Unlimited, or Enterprise Editions
  • Creating scripts to populate new orgs with such components as custom fields and custom objects

Deploying And Retrieving The Metadata

To deploy and retrieve the Metadata, use the deploy() & retrieve() calls. These commands allow you to move XML files that make up Metadata between the Salesforce org and the local file system. From here, you perform such file-based development operations as:

  • Copy and paste code as you wish Set up configs
  • Use a source-code control system to manage changes
  • Diff changes to components

These changes can then be deployed to any other Salesforce org.

Accessing Metadata API Functionalities

Force.com Migration Tool and Force.com IDE are the easiest way to access Salesforce Metadata API functionalities. The two tools are built atop the API and they use the standard Ant and Eclipse tools.

  • Force.com Migration Tool: Built on the Ant platform. Best used when using the command line or a script to move Metadata between Salesforce org and a local directory.
  • Force.com IDE: Built on the Eclipse platform: Used by programmers who already know how to use integrated development environments (who can deploy, code, compile, and test from within the IDE).

When using Force.com Migration Tool or Force.com IDE, the deploy() & retrieve() calls are still used, but they are invisible and seamless – you do not need to write code that calls the two commands.

Metadata API Format

The data in the XML files that make up Metadata is in English (United States) locale format. This way, fields that are dependent on locale like date fields are consistently interpreted during the data migrations between different orgs using different languages and you can use any language you wish to make a presentation in your organization.

Note that Metadata API is meant for building tools used in the Metadata model management and for managing customizations, not for the data itself. If you want to retrieve, create, update, or delete such records as leads or accounts, you would need REST API or SOAP API.

Comments