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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

File-Based Callsretrieve()}}// and the status should be Canceled. However, in very rare cases,// the deployment can <strong>com</strong>plete before it is canceled.)System.out.println("Final deploy status = >" + deployResult.getStatus());retrieve()This call retrieves XML file representations of <strong>com</strong>ponents in an organization.SyntaxAsyncResult = metadatabinding.retrieve(RetrieveRequest retrieveRequest)UsageUse this call to retrieve file representations of <strong>com</strong>ponents in an organization.Note: <strong>Metadata</strong> <strong>API</strong> can deploy and retrieve up to 5,000 files at one time. While a specific file size limit is notenforced, you might encounter out-of-memory errors for very large files.To retrieve packaged or unpackaged <strong>com</strong>ponents:1. Issue a retrieve() call to start the asynchronous retrieval. An AsyncResult object is returned. If the call is <strong>com</strong>pleted,the done field contains true. Most often, the call is not <strong>com</strong>pleted quickly enough to be noted in the result. If it is<strong>com</strong>pleted, note the value in the id field returned and skip the next step.2. If the call is not <strong>com</strong>plete, issue a checkStatus() call in a loop using the value in the id field of the AsyncResult object,returned by the retrieve() call in the previous step. Check the AsyncResult object returned until the done field containstrue. The time taken to <strong>com</strong>plete a retrieve() call depends on the size of the zip file being deployed, so use a longerwait time between iterations as the size of the zip file increases.3. Issue a checkRetrieveStatus() call to obtain the results of the retrieve() call, using the id value returned in thefirst step.PermissionsYour client application must be logged in with the “Modify All Data” permission.ArgumentsNameretrieveRequestTypeRetrieveRequestDescriptionEncapsulates options for determining which packages or files are retrieved.ResponseAsyncResultSample Code—JavaThis sample shows how to retrieve <strong>com</strong>ponents into a zip file. See the deploy() sample code for details on how to deploy azip file.34

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

Saved successfully!

Ooh no, something went wrong!