Getting error 500 (protocol error) when trying to POST to summaryReports endpoint

10292
1
Jump to solution
05-29-2013 03:38 PM
DavidButz
New Contributor III
I am trying to write some javaScript code to include demographic reports in my app. Just as a first run, I am trying to use the sample from here:

http://baoapi.esri.com/rest/reportform/summaryReports

and turn it into a POST with this code:

var reportOptions = '[{"TemplateName":"dandi","ReportFormat": "PDF"}]';
    var reportArea = '[{"RecordSet":{"geometryType":"esriGeometryPolygon","spatialReference":{"wkid":4326},"features":[{"geometry":{"rings":[[[-117.195683,34.072105],[-117.195379,34.072102],[-117.195075,34.072096],[-117.194771,34.072085],[-117.194467,34.072069],[-117.194163,34.072049],[-117.193861,34.072025],[-117.193558,34.071996],[-117.193257,34.071963],[-117.180438,34.050561],[-117.180588,34.050341],[-117.180742,34.050123],[-117.180901,34.049907],[-117.181065,34.049693],[-117.181233,34.049482],[-117.181405,34.049273],[-117.181582,34.049067],[-117.181763,34.048864],[-117.181948,34.048663],[-117.182137,34.048465],[-117.182331,34.048269],[-117.182529,34.048077],[-117.18273,34.047887],[-117.182936,34.0477],[-117.183145,34.047517],[-117.183358,34.047336],[-117.183575,34.047159],[-117.183796,34.046984],[-117.18402,34.046813],[-117.184248,34.046646],[-117.18448,34.046481],[-117.184714,34.04632],[-117.184952,34.046163],[-117.185194,34.046008],[-117.185438,34.045858],[-117.185686,34.045711],[-117.185937,34.045567],[-117.18619,34.045428],[-117.186447,34.045292],[-117.186706,34.045159],[-117.186968,34.045031],[-117.187233,34.044906],[-117.1875,34.044785],[-117.18777,34.044668],[-117.188043,34.044555],[-117.188317,34.044446],[-117.188594,34.044341],[-117.188873,34.044241],[-117.189154,34.044144],[-117.189437,34.044051],[-117.189722,34.043962],[-117.190009,34.043878],[-117.190297,34.043797],[-117.190587,34.043721],[-117.190879,34.043649],[-117.191172,34.043582],[-117.191467,34.043518],[-117.191762,34.043459],[-117.192059,34.043404],[-117.192357,34.043354],[-117.192657,34.043308],[-117.192957,34.043266],[-117.193257,34.043229],[-117.193559,34.043195],[-117.193861,34.043167],[-117.194164,34.043143],[-117.194467,34.043123],[-117.194771,34.043107],[-117.195075,34.043096],[-117.195379,34.04309],[-117.195683,34.043087],[-117.195987,34.04309],[-117.196291,34.043096],[-117.196595,34.043107],[-117.196899,34.043123],[-117.197202,34.043143],[-117.197505,34.043167],[-117.197807,34.043195],[-117.198109,34.043229],[-117.198409,34.043266],[-117.198709,34.043308],[-117.199009,34.043354],[-117.199307,34.043404],[-117.199604,34.043459],[-117.199899,34.043518],[-117.200194,34.043582],[-117.200487,34.043649],[-117.200779,34.043721],[-117.201069,34.043797],[-117.201357,34.043878],[-117.201644,34.043962],[-117.201929,34.044051],[-117.202212,34.044144],[-117.195683,34.072105]]],"spatialReference":{"wkid":4326}},"attributes":{"OID":1,"AREA_ID":"1_1","STORE_ID":"1","RING":1,"RING_DEFN":"1","AREA_DESC":"0 - 1 Miles"}}]}}]';
   

   var layerUrl = "http://baoapi.esri.com/rest/reportform/summaryReports";
    var layersRequest = esri.request({
      url: layerUrl,
      content: {
        f:"json",
        ReportOptions: reportOptions,
        Boundaries: reportArea,
        AreaIDField: "AREA_ID",
        TaskOutputType: "GetReport"
      },
      handleAs: "json",
      callbackParamName: "callback"
    },
    {
      usePost: true
    });
    layersRequest.then(
      function(response) {
        console.log("Success: ", response.results);
      }, function(error) {
        console.log("Error: ", error.message);
    });


I changed a few of the parameters in Report Options to simplify it but I've tested it on the REST page and it works there. The boundaries parameters are exactly the same. I am using a proxy page with my credentials which works with other requests.

However this keeps giving me a status code 500 protocol error.

Any idea what I am doing wrong?

Thanks,
David
0 Kudos
1 Solution

Accepted Solutions
DavidButz
New Contributor III
Okay, turns out I was using the wrong URL. 

http://baoapi.esri.com/rest/reportform/summaryReports is the URL for the REST endpoint that you can use in a browser, but upon clicking EXECUTE, it makes a call to http://baoapi.esri.com/rest/report/SummaryReports. Also, the URLs are case sensitive.

Thanks to John in ESRI support for helping me figure this one out!

David

View solution in original post

0 Kudos
1 Reply
DavidButz
New Contributor III
Okay, turns out I was using the wrong URL. 

http://baoapi.esri.com/rest/reportform/summaryReports is the URL for the REST endpoint that you can use in a browser, but upon clicking EXECUTE, it makes a call to http://baoapi.esri.com/rest/report/SummaryReports. Also, the URLs are case sensitive.

Thanks to John in ESRI support for helping me figure this one out!

David
0 Kudos