Plugin Support
Bruce
(@ninjateamwp)
Hi @48hmorris ,
Thanks for coming today!
Here is an example code using jQuery:
var form = new FormData();
form.append("folder", "17");
form.append("ids[]", "30");
form.append("ids[]", "26");
var settings = {
"url": "https://wpfree.test/wp-json/filebird/public/v1/folder/set-attachment",
"method": "POST",
"timeout": 0,
"headers": {
"Authorization": "Bearer YYfJnbtjSTvTEcQYxZn0pJMHQmnxSDyvLPLw7EtJ"
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Here is an example using only JavaScript:
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YYfJnbtjSTvTEcQYxZn0pJMHQmnxSDyvLPLw7EtJ");
var formdata = new FormData();
formdata.append("folder", "17");
formdata.append("ids[]", "30");
formdata.append("ids[]", "26");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: formdata,
redirect: 'follow'
};
fetch("https://wpfree.test/wp-json/filebird/public/v1/folder/set-attachment", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Kind regards,
-Bruce-
Bruce,
Thanks for the quick reply – the only JavaScript example works like a champ.
Plugin Support
Bruce
(@ninjateamwp)
Hi @48hmorris ,
Good to know that and thanks so much and could you please motivate the developers team with a 5 star ratings, so they could do more prompt jobs in future 😉
https://ww.wp.xz.cn/support/plugin/filebird/reviews/
Kind regards,
-Bruce-`