I'm trying to deploy an Apex Class using Postman and the /metadata/deployRequest API. I get a 201 response, but when I check the deployment status, I see the error "No package.xml found".

Here's the complete body of my request including the base 64 zip. When I save the zip as a file and upload it using Workbench, it deploys.

Content-Disposition: form-data; name="json"
Content-Type: application/json

    "deployOptions" : {
        "allowMissingFiles" : false,
        "autoUpdatePackage" : false,
        "checkOnly" : false,
        "ignoreWarnings" : false,
        "performRetrieve" : false,
        "purgeOnDelete" : false,
        "rollbackOnError" : false,
        "runTests" : null,
        "singlePackage" : true,
        "testLevel" : "RunAllTestsInOrg"
Content-Disposition: form-data; name="file"; filename="deploy.zip"
Content-Type: application/zip


1 Answer 1


The physical data needs to be binary, not base64. In Postman, you can generate the body by using the form-data body type, and selecting the file to upload. See this answer on stack overflow.

  • Thanks, I found that post, but I wasn't sure how to upload the JSON section separately from the zip. I saved the deployment options as a JSON file, selected it on one line, then selected the zip file on a second line. I get a 500 with the message "An unexpected error occurred. Please include this ErrorId if you contact support: 1413132269-140266 (1602089773)" Commented Apr 6, 2023 at 16:08
  • But before we go to far debugging this, I ultimately just want to implement this in Apex and was just using Postman to understand the API. Do you know of any resources instructing how to do this specifically with this API? Commented Apr 6, 2023 at 16:11
  • @BrandonDeMatteis Apex makes it hard, because we don't have native binary support. Most people use EncodingUtil base64Encode/base64Decode or convertToHex/convertFromHex to build the proper payload.
    – sfdcfox
    Commented Apr 6, 2023 at 16:55
  • @BrandonDeMatteis Try this Q&A.
    – sfdcfox
    Commented Apr 6, 2023 at 16:57
  • Thanks for your help with this. I did get this working in the end using this solution: github.com/nicolas1bruno/multipart-data-apex-request Commented Apr 28, 2023 at 14:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .