Jump to content

ritwic

Member
  • Posts

    1
  • Joined

  • Last visited

Everything posted by ritwic

  1. I'm trying to upload images to my website through the commerce API with node.js. Here is my code so far. FormData and fetch have been imported. const form = new FormData(); form.append("file", fs.readFileSync("image.png")); const send_img = await fetch( "https://api.squarespace.com/1.0/commerce/products/" + image_id + "/images", { method: "POST", headers: { Authorization: "Bearer " + process.env.SQUARESPACE_API_KEY, "User-Agent": "MY-USER-AGENT", "Content-Type": "multipart/form-data", }, body: form, } ); I keep getting this error. { type: 'INVALID_REQUEST_ERROR', subtype: null, message: "Expected exactly one file part named 'file', but found none.", details: null, contextId: 'EPOYCREESOOSLEEWRAWX' } Can someone help me resolve this error ?
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.