How share stream using rest api

Your example is wrong, it can’t work because:

  1. Your first step is not necessary. Required step is to only assign permission to stream for user, your step two
  2. You use wrong parameter in step two. You use ID of stream and not ID user. Correct format for JSON:
    {"selected_grantee_capabilities":{"grn::::user:USER_ID":"view"}}
  • USER_ID should be ID of user, and not stream ID.

Complete example using curl:
curl 'http://172.28.128.15/api/authz/shares/entities/grn::::stream:STREAM_ID' -H 'Accept: application/json' -H 'Authorization: Basic BASE64' -H 'Content-Type: application/json' --data-raw '{"selected_grantee_capabilities":{"grn::::user:USER_ID":"view"}}'

  • Use your selected authentication for API: user name, password, token or session token.

If you want to share stream with multiple user you need to specify all users in API:
{"selected_grantee_capabilities":{"grn::::user:USER1_ID":"view","grn::::user:USER2_ID":"view"}}

2 Likes