4 Replies Latest reply on May 8, 2017 10:31 PM by RorohikoKris

    Calling an HTTPS API from JSX



      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!



        • 1. Re: Calling an HTTPS API from JSX
          sinious Most Valuable Participant

          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. Re: Calling an HTTPS API from JSX
            zegerh94535687 Level 1

            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!

            • 3. Re: Calling an HTTPS API from JSX
              sinious Most Valuable Participant

              You're welcome and good luck!

              • 4. Re: Calling an HTTPS API from JSX
                RorohikoKris Level 2

                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:






                Kris (Rorohiko)