generateToken for ArcGIS.com hosted service

3271
1
05-28-2014 01:31 PM
NilsBabel
Occasional Contributor II
I'm trying to use this sample to generate a token for a hosted feature service:
http://resources.arcgis.com/en/help/main/10.2/index.html#/Scripting_with_the_ArcGIS_Server_Administr...

However, the response sends back a 404 status.  Does anybody know what the server and port number should be for AGOL for organizations?  I've tried several variations:

www.arcgis.com
arcgis.com
maps.arcgis.com
usda.maps.arcgis.com
services1.arcgis.com/

I've tried several port numbers including 6080, 8080, 6443, and 443.  443 is the only port that will actually create a connection. 

For the tokenURL I have tried:
/arcgis/rest/generateToken
/arcgis/admin/generateToken
/arcgis/sharing/rest/generateToken

I feel like I must just have the wrong server, url, or port number.
0 Kudos
1 Reply
NilsBabel
Occasional Contributor II
The trick is to leave out the port number for ArcGIS Online features:

http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Root/02r30000009t000000/

For my request I used the following ID:
"http://www.argcis.com/sharing/rest/generateToken"  and then supplied parameters for username, password, client, and referer.

This link helps too:
http://resources.arcgis.com/en/help/main/10.1/index.html#//0154000005qn000000

Hope that helps someone with a similar problem.
0 Kudos