Hello,
First, sorry for my english.
I'm new in javascript development and i'm trying to update some product on my woocommerce website from airtable.
In the automation, i have a script where i try to retrieve a product, i use this code :
const reponse = await fetch("https://website.com/wp-json/wc/v3/products/54188?consumer_key=ck_xxxxxxxx&consumer_secret=cs_xxxxxxxx",{
"Method": "get",
"Headers":{
"Contant-Type" : "application/json"
}
});
return await console.log(reponse);
but i have a 403 error (Access Forbidden). When i put this "https://website.com/wp-json/wc/v3/products/54188?consumer_key=ck_xxxxxxxx&consumer_secret=cs_xxxxxxx... in the url, i have access to the product, i don't understand why i have a forbidden access with the script 😕
So i tried to pu the authentification in the headers :
const reponse = await fetch("https://website.com/wp-json/wc/v3/products/54188",{
"Method": "get",
"Headers":{
"Authorization" : "ck_xxxxx:cs_xxxx",
"Content-Type" : "application/json"
}
});
return await console.log(reponse);
but i have the same problem.
The woocommerce API documentation is only for node.js / python etc, anyone already did it in vanilla javascript ?