Using addRelationship with type APIKey2Item, not working

194
0
03-10-2022 04:09 AM
sab9000
New Contributor

I'm using the REST API to create a FeatureService and want to connect it to my API Key for use in a web application.

I use the endpoint /addRelationship with these values:

 

{
originItemId: "my_apikey_id",
destinationItemId: "my_feature_service_id",
relationshipType: "APIKey2Item"
}

 

The response is:

 

{
"success": true
}

 

But still it seems like the relationship is not created. It doesn't show up in the "Content and Items" section of the API Key page and I get the error message "You do not have permissions to access this resource or perform this operation." when I try to connect to the serviceURL from my webapp.

Is there an additional step I need to do to make it work?

When I use the "Add item" button in the aforementioned "Content and Items" section it works fine, but I can see from devtools that it uses the same REST API endpoint. It seems strange that it doesn't work when I use the REST API endpoint directly.

 

 

0 Kudos
0 Replies