AnsweredAssumed Answered

modify or view json created by PrintTask

Question asked by SRoberts on Dec 16, 2015
Latest reply on Dec 18, 2015 by SRoberts


  Our Firewall blocks the POST request from PrintTask.execute if the JSON is over a certain character length.  This happens when a user adds too many graphics to a map.  Currently the print task just fails.  Instead, I'd like to be able to do one of the following:

  1. query the length of the Web_Map_as_JSON and not execute the task if it is too long (instead I'll warn the user).
  2. or, edit the json to strip out the offending graphics layer if it is too big.


I found a couple of posts that mention the _getPrintDefinition().  This returns an object, and I could use it to find how many graphics are in each graphics layer, but I would really prefer converting the entire object to the same Json used by the task.  Is that possible?  If I could convert it, then I could determine how many characters the Json is, and achieve 1. above.


Even better would be if I could somehow edit the Json before the print task sends it and achieve 2. above.  However, from what I've found, this doesn't seem possible.


Any suggestions?  Thanks, S. Roberts