Batch Request | JS API


(Lewis) #1

batchRequest doesn’t work when using %results_0_0_id% for example.

The code from Squiz’s own manual (see below) produces the following error, substituting a real asset ID for the getChildren function in the first array.

image

js_api.batchRequest({
   "functions":{
      "0":{
         "function":"getChildren",
         "args":{
         "asset_id":"100",
         "levels":1,
         "type_codes":"page_standard",
         "get_attributes":0
         },
         "blocking":1
      },
      "1":{
         "function":"setAttribute",
         "args":{
         "asset_id":"%results_0_0_id%",
         "attr_name":"short_name",
         "attr_val":"new short name"
         }
      }
   },
   "dataCallback":customDataCallbackFunc
}); 

Any ideas @Bart? I’ve also got this one open too.


(Bart Banda) #2

Not sure about this one either, tried to replicate it on the latest 5.5 and also get a bug. Will lodge it with the dev team to investigate further.


(Lewis) #3

Ok, cheers @Bart. Can you let me know a timescale from the dev team for this getting fixed?


(John gill) #4

Oddly, I can’t replicate this issue on either 5.5.1.5 or 5.5.7.1 - the example works as is.

I’d check to make sure that your JS API asset has the correct functions enabled, and has “Allow Batching Requests” enabled as well.