Uploading a draft Zip deploy via REST API

Hi,

We’re having issues with the netlify “deploy” command taking a long time (~5 min).

Instead, we’d like to use the Zip file method to create a draft deploy. The zip method (Get started with the Netlify API | Netlify Docs) creates a production deploy instead.

Is there a way to use the Zip method to create a draft deploy instead?

Thanks

Any deploy that you don’t publish to production is “draft” by default, unless I’m misunderstanding what you mean by draft. Could you clarify?

I’m facing this as well.

When I use the command below (which was copied directly from here: Get started with the Netlify API | Netlify Docs) with my site’s information, it creates a production deploy and not a draft deploy.

curl -H "Content-Type: application/zip" \
     -H "Authorization: Bearer YOUR_OAUTH2_ACCESS_TOKEN" \
     --data-binary "@website.zip" \
     "https://api.netlify.com/api/v1/sites/mysite.netlify.app/deploys"

I’m trying to figure out how to adapt this command to do a draft deploy.

The docs should be updated to fix this since this can cause unexpected results.

@tomardern, did you figure out how to make this a draft deploy?

Adding a ?draft=true query parameter to the URL seems to enable draft uploads with zip files, e.g:

curl -H "Content-Type: application/zip" \
     -H "Authorization: Bearer YOUR_OAUTH2_ACCESS_TOKEN" \
     --data-binary "@website.zip" \
     "https://api.netlify.com/api/v1/sites/mysite.netlify.app/deploys?draft=true"
1 Like