Skip to main content
zegerh94535687
Participant
March 23, 2016
Answered

Calling an HTTPS API from JSX

  • March 23, 2016
  • 2 replies
  • 8290 views

Hi,

I'm trying to call a HTTP API (which is mine) from InDesign. The API returns JSON and is publicly accessible over HTTPS (HTTP doesn't work!).

Now i tried the GetURL functionality as described in this blogpost (Rorohiko: GetURLs.jsx - access HTTP content from InDesign ExtendScript) and the http.get() from Extendables (http: sending and receiving http requests — Extendables v0.3a documentation)

With both methods HTTP calls work fine but my API requires the call to be over HTTPS and I can't seem to figure out how to do this.

I tried to set the host to e.g. "Host: myendpoint.com:443" but that also doesn't work.

I also have no clue what the culprit is. The Socket error (socket.error) is empty and can't seem to find any other error reporting facilities.

Hope you know what the problem is and how to fix it!

Thanks,

Zeger

This topic has been closed for replies.
Correct answer sinious

Just $0.02 but I believe you've found the end of the support for the HTTP abilities of the Extendables framework.

The 2 cent part is, although it's much more challenging, Adobe's script API can make use of other languages with more features, such as COM / VBScript on Windows and AppleScript on OSX. The script API can hand the request to those languages in addition (or a c++ library) and they can fully handle the request and then would need to return the data back to the script API. Not for the feint of heart.

Finally, while it's certainly not the most silky road, you might consider sort of a 'proxy', similar to how CORS is is sometimes handled. If you have a script on a web server (any language), say, PHP, you could send a HTTP request to it specifying the HTTPS target and any other arguments, while PHP then performs the HTTPS request and returns the information back to you in HTTP. Not elegant but there's always several ways to handle any situation.

2 replies

Inspiring
May 9, 2017

Hi all,

Just a quick note: I've revisited the old GetURL and made a more modern version which does support https as well as http. All smoke and mirrors. More information and source code on my personal blog:

http://coppieters.nz/?p=133

Cheers,

Kris (Rorohiko)

sinious
siniousCorrect answer
Legend
March 23, 2016

Just $0.02 but I believe you've found the end of the support for the HTTP abilities of the Extendables framework.

The 2 cent part is, although it's much more challenging, Adobe's script API can make use of other languages with more features, such as COM / VBScript on Windows and AppleScript on OSX. The script API can hand the request to those languages in addition (or a c++ library) and they can fully handle the request and then would need to return the data back to the script API. Not for the feint of heart.

Finally, while it's certainly not the most silky road, you might consider sort of a 'proxy', similar to how CORS is is sometimes handled. If you have a script on a web server (any language), say, PHP, you could send a HTTP request to it specifying the HTTPS target and any other arguments, while PHP then performs the HTTPS request and returns the information back to you in HTTP. Not elegant but there's always several ways to handle any situation.

zegerh94535687
Participant
March 25, 2016

We considered both of the options you describe and hoped there would be a better way to deal with this.

Anyways, thanks for your reply and we'll see how we'll fix this!

sinious
Legend
March 25, 2016

You're welcome and good luck!