I'm using cloudrail Node.Js v2.17.3.
I have to do an advanced request on OneDrive API.
The authentication part and getting/storing credentials have succeeded. Here is the request I have to do (according to OneDrive's doc): /drive/root/search(q='IMG_001.jpg')
Of course, the file is present in my OneDrive account.
Here is the code :
const req = new cloudrail.types.AdvancedRequestSpecification("/drive/root/search(q='IMG_001.jpg')");
req.setMethod("GET");
req.setHeaders({"Content-Type": "application/json"});
service.advancedRequest(req, (err, res) => {
console.log(err, res);
});
Err.message says : "Invalid API or resource".
However, when I try the simple request "/drive/root/children", it works...
Thank you in advance.
Microsoft recently introduced their new Graph API which is used by all of the services as far as I know. So the documentation you are referring to is for the new API. Try using '/drive/items/{the_folder_id or root}/view.search?q=txt' instead. You also might need to url encode the parameter. So the safest solution would probably be sth like that:
const url = "/drive/items/root/view.search?q=" + encodeURIComponent("[search query]");
const req = new cloudrail.types.AdvancedRequestSpecification(url);
req.setMethod("GET");
service.advancedRequest(req, (err, res) => {
console.log(err, res);
});