URL fetch/post?

Hi,

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:

Product: OmniGraffle-7.4.x
Tag:
Date: 2017-06-29 13:27:13 -0700
Builder: omnibuild
Host: tb1010h.private.omnigroup.com
Revision: 291208

Cheers,

ast

Hey @ast,

Did you eventually able make a POST request? If yes, can you point me to an example or some documentation on how to accomplish that?

Thanks,
V

Hi Vikram,

Unfortunately not. Apparently there are only 3 OG users who want this feature, so it’s pretty-much in the toilet as far as the priority goes.

Best bet based on lack of clipboard support as next best alternative, I think the only remaining option is to follow @draft8 and poke through JXA.

Wish I had better news…

@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 :).

Hi @cwelrup,

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.

I’ll be one of the first for your petition!

Thanks!

Support for this is now available in the latest public test builds of OmniGraffle:

  • APIURL.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!)

1 Like