The new fetch() command

I played with the new fetch() command in 9.6. A very nice improvement!

And very impressive to have an updated version of aTbRef already!

The sample in acrobatfaq was confusing on the first look:

fetch(rwURL(page),rwHeaders(auth),"temp","rwParse(temp,/log,0)");

There are some functions like rwURL() or rwHeaders() that do not speak for themself.

How about:

var string aServerULR = "https://yourserver.com";
var string myPayload = "?status=publish";

fetch(aServerULR + myPayload,{Content-Type: application/json},"aTempVariable","doProcessCallback(aTempVariable);",POST)

function doProcessCallback(returnValue:string) {
   show(returnValue);
};

And a feature request: I need DELETE as httpMethod too.

1 Like

Ah. I lifted that sample from release notes and the source is incomplete in that it draws on a load of missing (code for) functions: rwURL(), rwHeaders(), rwParse(), rwSetup(), rwMarkInProgress().

So in:

fetch(rwURL(page),rwHeaders(auth),"temp","rwParse(temp,/log,0)");

All except the third argument ("temp") are actually function calls. Great for showing the use of evaluated arguments, less good for ‘my first code example’ for fetch()! In truth this is one of the features I didn’t test heavily (I wasn’t one of those asking for that feature) so I assumed the example given by others were effective.

OK., I’ve used your example, in an updated page here: fetch(urlStr,headersDict,attrNameStr,cmdStr[,httpMethod]).

2 Likes