Help Setting Up Send Web Request to Get an Image
I am trying to get a map image from an open service.
I have the Url set to the export service (ie. https://server/arcgis_map/rest/services/App_EMD/emd_service/MapServer/export)
The method is POST
Headers are ={"Content-Type": "application/json"}
JSON is ={"f":"pjson","outputFormat": "PNG","bbox": "6109764, 2201662, 6341772, 2315987","imageWidth": "900","imageHeight": "500" }
I think I should be getting the URL of the map image back, but instead, I and getting the markup to recreate the Export Supported Operation.
What do I need to set the the JSON?
-
Whenever you use the POST method, the body must be sent as a form. There is a brief mention of that at the bottom of this page.
In a workflow, you can use the Send Web Request activity to achieve this. Using your above data as an example, the inputs would be set as follows:
- Url: https://server/arcgis_map/rest/services/App_EMD/emd_service/MapServer/export
- Method: POST
- Headers: ={"Content-Type": "application/x-www-form-urlencoded" }
- Form: = {"f":"pjson","outputFormat": "PNG","bbox": "6109764, 2201662, 6341772, 2315987","imageWidth": "900","imageHeight": "500" }
0 -
Hello, I'm pulling out my hair on a similar issue. I'm querying the Esri enrichment service to return population numbers for a geometry. If I use a simple geometry with a GET, it works fine.
But it breaks down when the geometry is complex, I assume because of the url size limit.
So I'm trying to do a web request with a POST, using the following parameters:
Url: https://geoenrich.arcgis.com/arcgis/rest/services/World/GeoenrichmentServer/Geoenrichment/enrich
Method: POST
Headers: ={"Content-Type": "application/x-www-form-urlencoded" }
Form: ={"studyAreas":[{"geometry":{"x":-117.1956,"y":34.057}}],"analysisVariables":["KeyGlobalFacts.TOTPOP"],"f":"pjson","token":"<tokenGoesHere>"}
It returns the following error:
{
"results" : [ {
"paramName" : "GeoEnrichmentResult",
"dataType" : "GeoEnrichmentResult",
"value" : {
"version" : "2.0",
"FeatureSet" : [ ]
}
} ],
"error" : {
"code" : 10020007,
"message" : "Parameter 'studyAreas' is invalid.",
"details" : [ ],
"causes" : [ {
"code" : 10020049,
"message" : "Invalid attribute 'StudyAreas'.",
"details" : [ ]
} ]
},
"messages" : [ ]
}
Any idea what I'm doing wrong?
Thanks,
Chris
0
Please sign in to leave a comment.
Comments
2 comments