AnsweredAssumed Answered

Geoenrichment POST Requests

Question asked by broadstreet on Sep 30, 2014
Latest reply on Oct 1, 2014 by broadstreet

I've been working on an app for a presentation and we are using ArcGIS Online to geoenrich Canadian Census Dissemination Areas upon the users click. The only catch here is that some of the polygons are causing the request URLs to exceed the 2048 character limit in URLs. We are using the ESRI Proxy.ashx that you can get from GitHub and so i switched from a get request to a post request only the Post request doesn't seem to recognizes the variables being passed in the form data.

 

This first link is the request in Raw Format as captured by fiddler

http://imgur.com/xlWfh6F

The second link is the same request in WebForm view

http://imgur.com/3fPoHlL

 

This is the code i'm using to make the request to the proxy server, the proxy adds the token, after it gets the information from our ArcGIS Online account

           
            var studyAreas = {
                /*    areaType: "RingBuffer",
                    bufferUnits: "esriKilometers",
                    bufferRadii: [2],*/
                geometry: evt.graphic.geometry
            }
            var sa = JSON.stringify(studyAreas);
            var dem = new Demographics;


            var cats = dem.categories;
            var av = '[';
            for (l = 0; l < cats.length; l++) {
                var curCat = dem[cats[l]]
                for (m = 0; m < curCat.length; m++) {
                    av += curCat[m].varName;
                    av += ',';
                }
            }
            av = av.substr(0, av.length - 1);
            av += ']';
            request.post('/proxy/proxy.ashx?http://geoenrich.arcgis.com/arcgis/rest/services/World/GeoenrichmentServer/Geoenrichment/enrich', {
                data: {
                    StudyAreas: sa,
                    analysisVariables: av,
                    forStorage: false,
                    f: 'json'
                }
            });



Outcomes