#post gif to an API using fectch

1 messages · Page 1 of 1 (latest)

hazy arch
#

hello, I am creating a project for my internship and using Giphy API, I am trying to implement Upload gif feature to my project but not able to understand document, can someone pls help me write the code for the same, its important and urgent, Thanks in advance,
reference: https://developers.giphy.com/docs/api/endpoint#upload
code I am trying to write,

const upload = () => {
let url = https://upload.giphy.com/v1/gifs?api_key=${API_KEY};
fetch(url, {
method: "POST",
header: "I don't understand what to put here",
body: "I don't understand what to put here"
}).then(res => res.json()).then(data => console.log(data));
}

limber finch
#

Looks like this is the endpoint you'd need

#

So in the docs, there is a file property that you can use to upload the binary data of the gif. Alternatively, you can use the source_image_url if the gif is already published on the internet

slender bison
#

@hazy arch Ask CHATGPT. That will definitely help you with this. I'm serious