Select to view content in your preferred language

Using rest for Feature Layer

516
4
Jump to solution
07-04-2024 01:38 AM
StephenHall3
Emerging Contributor

I am new to arcgis and trying to setup oauth to access a feature layer.

My assumption is that I needed to create an application with oauth credentials and (on successful authorisation) a redirect url to the feature layer (where I would pass the token) but I get "you do not have permissions...." message (GWM_0003).

Could someone offer some pointers to achieving the objective?

Thanks

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
StephenHall3
Emerging Contributor

Success.

For anyone trying to figure this out (because I could not find any clear examples of how to implement this from beginning to end) here is how it was done.

1. Create a Feature Layer which will contain the database table (columns and rows).

2. Create an Application which will contain a Client ID , Client Secret and a Redirect URL (which will be the url of the Feature Layer) . 

3. Using Postman you will enter the URL of the Application, passing in the params client_id, client_secret and grant_type

4. a Token will be returned

5. Using Postman you will enter the URL of the Feature Layer similar to the following:

https://<domain>/<context>/rest/services/<Feature  Layer Name>/FeatureServer/<Dataset/Table Name>/query? along with the following parameters:

f = json, token=[token val you prev received], address=[post code/zip/full address etc], outFields=*,where=[query string ie postcode like 'EH3 4QW']

This will return a json file containing all the properties and values relative to the query

 

 

View solution in original post

4 Replies
Georgios-NektariosTselos
Regular Contributor

Hello @StephenHall3  the only thing you have to do for the "permissions message"  is to differentiate the option when you share it from owner to public or to the organization you belong  to,  so that everyone has access. So you need to generate an access token,  the following links will help you  :https://developers.arcgis.com/rest/users-groups-and-items/generate-token/ 

https://developers.arcgis.com/documentation/security-and-authentication/user-authentication/oauth-cr... 

Kind Regards

Georgios-Nektarios Tselos

StephenHall3
Emerging Contributor

I think I am one step closer.

I am now retrieving the feature service settings/structure.

The first screen capture shows the token being passed to the Feature Layer and returning  various settings.

img02.jpg

The 2nd screen capture is the table for the Feature Layer.

img03.jpg

I'm assuming there is something I need to add to the url that ends "CAG_MONTHLY_RESIDENTIAL" to retrieve data from the table.

 

Georgios-NektariosTselos
Regular Contributor

Yes,   i suggest to check both of  these links  and i think you will solve your issue

https://developers.arcgis.com/rest/users-groups-and-items/token/ 

https://developers.arcgis.com/rest/users-groups-and-items/root/ 

Kind Regards

Georgios-Nektarios Tselos

0 Kudos
StephenHall3
Emerging Contributor

Success.

For anyone trying to figure this out (because I could not find any clear examples of how to implement this from beginning to end) here is how it was done.

1. Create a Feature Layer which will contain the database table (columns and rows).

2. Create an Application which will contain a Client ID , Client Secret and a Redirect URL (which will be the url of the Feature Layer) . 

3. Using Postman you will enter the URL of the Application, passing in the params client_id, client_secret and grant_type

4. a Token will be returned

5. Using Postman you will enter the URL of the Feature Layer similar to the following:

https://<domain>/<context>/rest/services/<Feature  Layer Name>/FeatureServer/<Dataset/Table Name>/query? along with the following parameters:

f = json, token=[token val you prev received], address=[post code/zip/full address etc], outFields=*,where=[query string ie postcode like 'EH3 4QW']

This will return a json file containing all the properties and values relative to the query