Zum Hauptinhalt gehen

How to use Send Web Request activity to get data from Esri enrichment service

Kommentare

7 Kommentare

  • Ken Lyon

    Hi Chris,

     

    I think the form content needs to be in the same format as the original query string:

     

    Urlhttps://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>

     

    Also, not sure if it was a typo, but your initial GET method has a query string that starts with ?&studyAreas= instead of just ?studyAreas=.

    0
  • Chris Dunlop

    Hi Ken. You were right about the typo in the GET request (although it still works).

     

    I tried your suggestion on the POST method, but it returns an error 404 - unable to process this request. I had used JSON object notation for the form body based on your suggestion on another thread (https://communities.geocortex.com/s/question/0D5f200006MO8kQCAT/help-setting-up-send-web-request-to-get-an-image).

     

    In WF4 it worked using the WebRequest activity, sending a dictionary in the Parameters argument (with "studyAreas" as the key)

     

    Any ideas?

     

    Thanks,

     

    Chris

     

     

     

    0
  • Ken Lyon

    Don't you love it when someone contradicts their previous advice? :) Now that I look at it, I realize my first response here was wrong. I was thinking of what should end up being sent in the POST request, but what you had was correct for the inputs to the activity.

     

    Does it work if you send the equivalent data using Postman?

    0
  • Ken Lyon

    I'm guessing you're working through this tutorial:

    https://developers.arcgis.com/labs/rest/get-demographic-data/

     

    Do you need to add studyAreasOptions?

    "studyAreasOptions": { "areaType":"RingBuffer", "bufferUnits":"esriMiles", "bufferRadii":[1] }

     

    0
  • Chris Dunlop

    I wasn't working through that tutorial, but I installed Postman and followed the directions using just the parameters I used earlier (studyAreas, analysisVariables, f, token). It worked correctly. So the problem is definitely in the way I'm formatting the form parameters

    0
  • Chris Dunlop

    Aha, got it by looking at the Code and selecting Javascript - Fetch. The correct syntax for the form is:

     

    ={"studyAreas":"[{\"geometry\":{\"x\":-117.1956,\"y\":34.057}}]","analysisVariables":"[\"KeyGlobalFacts.TOTPOP\"]","f":"pjson","token":"<tokengoeshere>"}

    0
  • Ken Lyon

    Glad you were able to solve it!

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.