Hello,
I have a web page that takes a query then submits it the the ArcGIS server rest end point,
http://myserver/arcgis/rest/services/myService/MapServer/0/query
the web page looks like the following image and I sucessfully pass the parameters and receive the results.
My issue is that I am reading from a secured service and every time I hit the button "Get the Map" it asks me to login the arcgis server.
I know that I can use a token to get the results, but unfortunately I couldn't figure out how to include it in the submit button.
<form name="sdform2"
action="http://MyServer:6080/arcgis/rest/services/MyService/MapServer/1/query"
method="post">
<tr valign="top">
<p hidden>
<td>Where:</td>
<td>
<input type="text" Name="where" Id=whereNodes value="NID='test'" size="45">
</p>
<br>
<br>
<table border=".1">
<tr align="center">
<td width="120">Title</td>
<td>
<p hidden>
<input type="text" id="outNodeFields" name="outFields" value="*" size="75">
<select name="f">
<option value="kmz">KMZ</option>
<option value="json">json</option>
</select>
</p>
</td>
<td>
<input type="submit" value="Submit">
</td>
</tr>
</table>
</form>
Any help is highly appreciated.
Thank you,
Ahmad
Solved! Go to Solution.
I haven't taken the approach that you have, but I would try something like the following. You will need to log in at some point to get a token, and it will time out eventually, but you can reuse it a number of times. If the layer is publicly shared, a token may not be required.
<form ......>
<input type="hidden" id="token" name="token" value="your token goes here">
<input type="submit" value="Submit">
</form>
I haven't taken the approach that you have, but I would try something like the following. You will need to log in at some point to get a token, and it will time out eventually, but you can reuse it a number of times. If the layer is publicly shared, a token may not be required.
<form ......>
<input type="hidden" id="token" name="token" value="your token goes here">
<input type="submit" value="Submit">
</form>
Thank you Randy for your input, I changed my approach a little bit, and used your hint, the action link was changed to
and I removed all other variables from the form.
Thank you,
Ahmad