Home
Support Forums

Deploy using file digest

sharp-leavitt-345290

is my site, but is not deployed for reference

im trying to deploy a new site to netlify using netlify api i am following Get started with the Netlify API | Netlify Docs

- POST /api/v1/sites/{site_id}/deploys
-{
  "files": {
      "/index.html": "907d14fb3af2b0d4f18c2d46abe8aedce17367bd",
      "/main.css": "f18c2d7367bd9046abe8aedce17d14fb3af2b0d4",
      },
  "functions": {"hello-world": "708b029d8aa9c8fa513d1a25b97ffb6efb12b423"}
}

is the example heres my attempt

var fileHash = '{"files":{"C:\Users\aaron\OneDrive\Desktop\node\getHash\test.txt" : "5a1519f5b36692e0ab3bed8dd63e4284c5cf2b14" }}'

var otheParam2 = {
headers:{
'Authorization': 'Bearer ' + myToken
},
body : fileHash,
 method: 'POST'
}


fetch(Url,otheParam2).then(function (response) {return response.json(); }).then(function (data) {console.log(data)});

the screenshot is my results, any tips?

Hi @aaronlilly84,

I’m not sure what the problem is here. Could you please eloborate?

when I post, with site Id using fetch()

I do not receive a deploy id in my response

I’m still confused, I can see that you’ve struck out the ID which means you got it in the response. There are other concerns with your API call, but I’ll like to get this one sorted before.