AnsweredAssumed Answered

Anyone have a curl example for the generateToken REST?

Question asked by tggagne on Sep 10, 2014
Latest reply on Jul 28, 2017 by carlosnantes

The documentation is unclear exactly how to send the username, password, and other parameters in the REST POST.

 

The documentation is here : <ArcGIS REST API >

 

I've tried

 

curl -X POST https:///www.arcgis.com/sharing/rest/generateToken?username=me&password=XX&client=ip&ip=aa.bb.cc.dd

 

curl -X POST -d username=me -d password=XX -d client=ip -d ip=aa.bb.cc.dd https://www.arcgis.com/sharing/rest/generateToken

 

curl -X POST -d @ebody https://company.maps.arcgis.com/sharing/rest/generateToken

where ebody is a file containing

username=me

password=XX

client=ip

ip=aa.bb.cc.dd

 

and variations on all of them.

 

Does anyone have a working example, or explain what to use for the base url?  Does it matter?

 

Sometimes I'll get a 404, other times I get an HTML response:

 

<html>

<head>

<title>ArcGIS Portal Directory</title>

<link href="/sharing/rest/files/gw.css" rel="stylesheet" type="text/css"/>

</head>

<body>

<br/>

<div class="gwDiv">

<table class="navTable" width="100%"><tr><td class="breadcrumbs">ArcGIS Portal Directory</td></tr></table>

<tr valign="top">

<br/><br/>

<b>

<a href="http://resources.arcgis.com/en/help/arcgis-rest-api/" >API Reference</a>

</b>

 

</tr>

</table>

 

</div>

 

</body>

Outcomes