I’d originally posted this in the other thread, but since that’s kinda long, it’s likely to get buried. Before I send an email to Omni, I thought I’d bump the request here:
Have now downloaded a 7.4 build and made more progress, in addition to uncovering the docs for the URL method. Looks like I can pull things in, but I can’t push things out.
The URL#fetch signature only appears to support functions as arguments and nothing along the lines of working draft #fetch or proxying the properties of NSMutableURLRequest like providing #method or #body.
My objective is to trigger push notifications so that I can use OG documents as the definitive source of information vs. being a passive reflection of information. If I have a way to make POST requests, then everything’s fantastic.
I’ve now successfully poked OG from node via a wrapper around the ‘osascript’ utility, so things are getting more interesting. However, I’d still really, really prefer to be able to push things while the document is open rather than doing things via remote-control from another source.
Any way this can be included in 7.4? I’m now using this build:
@ast Did you ever find/get code working to POST? I’m also frustrated that we can’t do POST from the built-in URL.fetch method. Or even have the ability to custom-define headers for a GET request, which is closer to what I’m trying to do, as I need to send in authentication information for a web service. I’m not very familiar with using JXA in OG, but my initial tests have not been promising.
You can count me as the 4th OG user who want this :).
No. I actually haven’t gone near this stuff for quite a while. Based on what’s been going on with the business, it looks like I’ll be potentially getting back into more OmniJS work maybe in May/June.
However, I don’t think it’s a real priority for them or it would’ve been fixed. I can understand from a security perspective why this might potentially be dangerous, but you could always sandbox it with permissions on the specific calls, e.g., "Plugin XYZZY from Acme, Inc. wants to send data to website XXXXXX. Allow Once | Always Allow | Block
Something like that would keep the user squarely in control and give a SUPER valuable feature to the tools.
Maybe I should write an opt-in page petition and try and generate some additional support… ;)
Yep, understand this might be low, esp. given security considerations. But basic auth capabilities when calling an API seems like table stakes for many applications. The fact that OmniJS URL.fetch doesn’t handle that is disappointing.
API — URL.FetchRequest implements support for performing network requests customize the HTTP method, headers, or cache control settings. It returns a promise with a URL.FetchResponse , which includes details from the response such as the HTTP status code and headers. This makes it possible for Omni Automation scripts to work with network resources which require authentication or which use a RESTful API.
(This feature will be coming to all our apps over the next month or so, but you can try it out in these OmniGraffle test builds today—and we’d love your feedback!)