REST Location - Tying a Location request to a response RRS feed

  • Question

  • Here's my situation:

    I have a list of a bunch of different locations, and I make sequential calls for each location to get the lat/long to place a pushpin in a map (displaying 3 or 4 at a time, but this could be much greater).  I'm using Javascript to make the rest calls and by the time the callback function has executed I am unable to find a way to tie the specific response to the original record it was looking up. 

    If the returned address matches what we sent to lookup there isn't a problem because I can just search the list for the matching address and pair it that way. 

    In the event that the initial data was bad/off/different however, I have no way of being able to say that this particular response is for item x in the list.

    If there is a way to pass additional data into the request I could use that to match it up, though I am unable to find a way of doing this.  Does anyone know of a way to do this?

    Thursday, May 16, 2013 7:39 PM


  • I highly recommend that you geocode your data ahead of time rather than doing it on page load. This will make your application much faster and also, drastically reduce the number of transactions your application generates.

    Now to link your responses back to your requests you can use a state parameter in the request which will be returned in the response. If you make this value unique you can then look back for the request that used that state. Take a look at the jsono parameter in this documentation:

    In the callback function that gets fired by your application when this is done there will be two parameters in the response. The first will be the results, the second will be the state object you passed in.

    Friday, May 17, 2013 8:05 AM