Help with the API regarding deploys

Hey!

So quick question about the API: I’m attempting to deploy a site which requires a command to be run in order to be built. I uploaded the zip file and netlify unpacks it correctly. The zip file contains a netlify.toml file where the build command and the deploy directory is stated. What command and args should I give the API in order to build with those arguments?

The TOML is:

[build]
  command = "yarn run generate"
  publish = "dist"

Thanks!

While this is a great question it is also not possible.

For the manual deployment method no build command is run. The uploaded files are deployed as-is.

For a build process/command to be run, our continuous deployment is required.

1 Like

Hi @aguilaair,

Do you mind sharing the code you used to get the zip file to upload and unpack? I have gotten the file digest to working, but wanted to test out the zip file upload as well. I cannot figure out how to get it working. It just tries to unpack the zip file 5 times and then fails.

Thanks!

1 Like

Hi @garrettbland, we have an example in our docs. However, we recommend deploying via the digest method because then we’ll ONLY upload the changed files. When you do a zip upload then you have to upload every file included in the deploy.

1 Like

Thanks @futuregerald! I’m still trying to wrap my head around the digest method completely and netlifys build process. So for example, lets say I have a simple website with the following files.

index.html
about.html
contact.html

I make a change to the about.html file. So the next step is to create a new deploy with just that single file being required? Or do I still need to make sure all three files are required, but then only have to upload that single file with the new SHA1 hash?

@garrettbland, this is covered here.

When creating the content for digest of file paths and SHA1s, all files which are part of the deploy should be included.

The API will then reply with a JSON object where with a key “required”. The value for this key will be an array of SHA1s which are required to complete the deploy. Only the files which have their SHA1s in the “required” array need to be uploaded to complete the deploy.

Files not listed in that array already have an identical version deployed so uploading them again isn’t required.

1 Like

@luke I feel the same pain @garrettbland does about not completely understanding the documentation in regards to using digest deployments. Furthermore if deploying via zip is not the recommended way then why are the only examples shown using zip and curl deploys? It would be really helpful to see an example of a file digest deployment using the API, just don’t know how many developers at the end of the day are using curl for deployments.

A final comment regarding Aguilar’s original post, I personally think it’s a shame we can’t have a manual deployment run a build step. Since you have examples of the ‘Deploy to Netlify’ buttons taking an unbuilt repository and building it in one step, you would think the API would be able to handle this. I’d like to see this be possible for manual deploys with the API.

Hi @David_Davis! I actually wrote a short tutorial on this a few weeks ago. If you have any questions please let me know, I (feel like) I have a pretty decent grasp on this now. I linked my reply below.

Another good thing to keep in mind about Netlify, is that the entire dashboard utilizes the same API. Check out the console/networking in chrome dev tools and you can see it all in action. Pretty sweet! :clap:

2 Likes

Good to know, thanks @luke!