0

I have created account on Sandbox

I have then created a group with

curl -i -X POST \
   -H "Authorization: Bearer <ACCESS_TOKEN>" \
   -H "Content-Type: application/json" \
   -d \
"{
  \"context\": \"https://standards.oftrust.net/v2/Context/Identity/Group/\",
  \"type\": \"Group\",
  \"data\": {
    \"name\": \"Company Oy\"
  }
}" "https://api-sandbox.oftrust.net/identities/v1"

I have also created a Link between person and group, I used MemberOf

curl -i --request POST \
  --url https://api-sandbox.oftrust.net/identities/v1/{fromIdentityId}/link/{toIdentityId} \
  --header 'Authorization: Bearer <ACCESS_TOKEN>' \
  --header 'content-type: application/json' \
  --data '{
  "context": "https://standards.oftrust.net/v2/Context/Link/Role/MemberOf/",
  "type": "Member"
}'

I got successful response that link was created between those identities.

Trying to delete this link now, but I get as response 404 and message Link not found.

What I try is according with example from documentation

curl -i -X DELETE \
   -H "Authorization: Bearer <ACCESS_TOKEN>" \
 "https://api-sandbox.oftrust.net/identities/v1/{fromIdentityId}/link/{toIdentityId}/MemberOf"

[UPDATE]: I discovered also in Identity API documentation that can list all links of identity. And have made this for group identity:

curl -i -X GET \
   -H "Authorization: Bearer <ACCESS_TOKEN>" \
 "https://api-sandbox.oftrust.net/identities/v1/<group_id>/links"

The response shows that link between group and person identities.

1 Answers1

0

Firstly, make sure you respected the id values (their order) for From and To. They should be the same you get in response of https://api-sandbox.oftrust.net/identities/v1/<group_id>/links

Secondly, delete Link endpoint needs to be used with a type, as exemplified. In this case MemberOf. But looking at the creation of the link there is a typo: context used is correct, but the type is Member. Type should match the last part of the name in context => MemberOf

In this case, since you are trying to delete it, simply use Member

curl -i -X DELETE \
   -H "Authorization: Bearer <ACCESS_TOKEN>" \
 "https://api-sandbox.oftrust.net/identities/v1/{fromIdentityId}/link/{toIdentityId}/Member"
ra_tester
  • 252
  • 1
  • 7