Select to view content in your preferred language

How to pair Api Key and Feature Service

185
2
Jump to solution
09-04-2024 07:37 AM
sab9000
Emerging Contributor

I've returned to a project where I'm managing Feature Services/Layers through the ArcGis REST JS and consuming the data via a web frontend using the ArcGis Maps Javascript SDK authenticated with a Api Key.
After I create a Feature Service (using createFeatureService) and a Feature Layer (using addToServiceDefinition) I want to add the Feature Service to my Api Key programmatically so I can access it from my web frontend.


When I did this the first time (around 2022) I used the, now legacy, Api Key and connected my Feature Service to the Api Key using addItemRelationship. But now with the new (application) Api Key this doesn't seem to work. How is this done with the new Api Key type? I tried to use updateItem, but couldn't get it to work. Does anyone have any advice?

Another thing I noticed is that when I manually add an item to the Api Key via "Edit Item Access" in the Online portal, the API Key for the "Application" disappears and I have to generate a new Api Key. Is this how it is supposed to work?

0 Kudos
1 Solution

Accepted Solutions
John-Foster
Esri Contributor

The functionality for API keys changed on June 26, where they are fully documented here https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/  including new vs. legacy functionality. The new API keys are more secure and offer more features, but they work very different from the legacy keys.

Esri has not yet published the API specs how to programmatically manage the new API keys. I expect this will come in the future but I do not know of any timeline for it.

--jf

View solution in original post

0 Kudos
2 Replies
John-Foster
Esri Contributor

The functionality for API keys changed on June 26, where they are fully documented here https://developers.arcgis.com/documentation/security-and-authentication/api-key-authentication/  including new vs. legacy functionality. The new API keys are more secure and offer more features, but they work very different from the legacy keys.

Esri has not yet published the API specs how to programmatically manage the new API keys. I expect this will come in the future but I do not know of any timeline for it.

--jf
0 Kudos
sab9000
Emerging Contributor

Thank you for the information!
I guess I just have to wait for them to implement this functionality and find a way around it in the mean time.

0 Kudos