Set site name when building a site using a zip file

When looking at this example

You use curl to create a site but deploying a zip file.

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

Is there a way to set the site name as well, currently it gives it a random site name when you call this?

I believe if you set subdomain that should work. Did you try that?

If you mean like this:

`curl -H "Content-Type: application/zip" \
  -H "Authorization: Bearer {token}" \
  --data-binary "@{website_zip}" \
  -d '{"subdomain":"mysubdomainhello"}' \
  https://api.netlify.com/api/v1/sites

or like this

`curl -H "Content-Type: application/zip" \
  -H "Authorization: Bearer {token}" \
  --data-binary "@{website_zip}" \
  --json '{"subdomain":"mysubdomainhello"}' \
  https://api.netlify.com/api/v1/sites

Then yes, I’ve tried it, doesn’t seem to work.

I don’t know if you’ll be able to send a binary zipfile as data and also JSON data along with a request as you are seeming to try to do. Here’s a counterproposal:

I’d suggest that you make a two step process:

Hi, yes thats sort of what I’m currently doing, well kinda, I’m doing it the other way around. I’m first doing a zip upload, and then renaming the newly created site.