Select to view content in your preferred language

Rest url not accepting token= query string parameter.

597
2
10-03-2023 02:59 PM
Labels (1)
DonaldPike
Occasional Contributor

I'm trying to test out retrieving a feature layer using the REST api. I have code that issues a /generateToken POST request that successfully returns a token, but then when I issue a subsequent GET request with

?token=<token returned from generateToken>

I gat an error message of "Invalid token".


Here is a screenshot of the GET request in Postman (I used a token that was generated seconds before issuing the GET request).

Screenshot on 2023-10-03 at 14-57-20.png


Here's the format of the url that I'm using to try to retrieve the feature layer (I'm not 100% certain that the url is correct):
https://services7.arcgis.com/XXYYXXYYZZ/arcgis/rest/services/Name_of_feature_Layer/FeatureServer?token=xxxxxxxxxxxx

Tags (1)
0 Kudos
2 Replies
MiguelParedes
Esri Contributor

Greetings @DonaldPike 
Have a look at the article from our friends from Esri Australia titled FAQ: How do I generate a token in ArcGIS Online for accessing secure resources?

Hope that helps.

Miguel
0 Kudos
DonaldPike
Occasional Contributor

Hello and thanks for the info @MiguelParedes 

I'm actually already able to successfully generate a token with the generateToken POST request.

Where I'm having problems is with a subsequent GET request to retrieve a feature layer from a feature service. Something about how the GET request is constructed is not in the format that the server is expecting.

0 Kudos