0

I am using axios for the request module. I just want to be able to specify the filename of the image and can't figure out how to do this with this endpoint:

const { data } = await axios({
   method: `post`,
   url: `https://${projectId}.api.sanity.io/v1/assets/images/${dataset}`,
   data: body, // readable stream for image here
   headers: {
      "Content-Type": contentType || `application/json`,
      Authorization: `Bearer ${process.env.SANITY_TOKEN}`
    },
}) 

I don't really want to use the @sanity/client.

Taylor Austin
  • 5,407
  • 15
  • 58
  • 103

1 Answers1

0

Just need to add a Query String to the end of the url:

https://${projectId}.api.sanity.io/v1/assets/images/${dataset}?filename=myImage.jpg

Taylor Austin
  • 5,407
  • 15
  • 58
  • 103