I’m trying to create a script to upload an image of handwritten notes to the Azure Computer Vision API. When you make the API call the response has no body; the response header contains a URL that you are supposed to use to access the resulting OCR data.
loadString are only dealing with the body of the response…
Wouldn’t you use
var req = new XMLHttpRequest();
If AJAX is involve things are, iirc, slightly different.
Perhaps @simonbs could comment on what the properties/functions Request.load() returns. If I output to the console the regsult of Request.load I get “[Object ScriptableKit.DataBridge]”. However I don’t see where DataBridge is documented. If its the same thing as “Data” in the documentation then it doesn’t provide access to header info.
That’s as far as I’ve gotten as well. @simonbs I’d love to know if there’s a way to get the response headers, or if that’s something that could be added in a future version!
@stevehahn Sorry for not getting back to you. Getting the response from a request will be possible in version 1.1.0 of Scriptable. The request will have a
response property that is populated when the request have finished.
@simonbs Excellent, thanks a lot!