• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Best practice calling REST api from plugin

Explorer ,
Mar 19, 2018 Mar 19, 2018

Copy link to clipboard

Copied

I need to call a REST service from my plugin. What would be the best practice to do so? I have tried to find a suitable function for this in the SDK, but I dont think there is such. Therefore I was thinking of using wininet under windows (and something similar for Mac). Is there a better way to do this?

TOPICS
Acrobat SDK and JavaScript

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 19, 2018 Mar 19, 2018

There isn't anything in the Plug-in SDK for handling HTTP interactions. As you've already mentioned, you'd have to use another SDK for this. However, there is a simple Acrobat based option that might work for making REST requests from a plug-in.  The Acrobat JavaScript model includes an NET.HTTP object which makes raw HTTP Requests. This object can be accessed from a plug-in with the Forms HFT. The AFExecuteThisScript function. I don't know if this is any better for not stopping up Acrobat, but

...

Votes

Translate

Translate
LEGEND ,
Mar 19, 2018 Mar 19, 2018

Copy link to clipboard

Copied

You should bear in mind that if your plugin does anything that waits, then all of Acrobat will hang. Net connections potentially wait a long time, especially if there are net outages.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 19, 2018 Mar 19, 2018

Copy link to clipboard

Copied

There isn't anything in the Plug-in SDK for handling HTTP interactions. As you've already mentioned, you'd have to use another SDK for this. However, there is a simple Acrobat based option that might work for making REST requests from a plug-in.  The Acrobat JavaScript model includes an NET.HTTP object which makes raw HTTP Requests. This object can be accessed from a plug-in with the Forms HFT. The AFExecuteThisScript function. I don't know if this is any better for not stopping up Acrobat, but it can be setup to be asynchronous.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 21, 2018 Mar 21, 2018

Copy link to clipboard

Copied

Thank you, I am in the process of testing a couple of SDKs at the moment. Will let you know which one I used.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 22, 2018 Mar 22, 2018

Copy link to clipboard

Copied

If you can find an API that doesn’t need you to install support files like DLLs that may be best. DLL search order is awkward for plugins because it does not include the plugin folder.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 22, 2018 Mar 22, 2018

Copy link to clipboard

Copied

True, hopefully I will avoid just that. Right now I am trying out one that don't need something in addition. Thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 15, 2018 Apr 15, 2018

Copy link to clipboard

Copied

So, I ended up using the Beast library from Boost. Works nice. I have also tested with Cpr based on lib curl and that works fine too.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 08, 2022 Nov 08, 2022

Copy link to clipboard

Copied

LATEST

@runesigurdsen I am having smae requirement, can you please assist with any documentation or Git Repo which will help me and other users? Please advise.

thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines