Edit in GitHubLog an issue

Shares APIs

The CJA Shares APIs allow you to retrieve, update, or create shares and their association with components programmatically through Adobe I/O. The APIs use the same data and methods that are used when working with shares in the UI.

/componentmetadata/shares endpoint description#

The /componentmetadata/shares endpoint description is shown in our Swagger UI. Use the Swagger UI to see endpoint summaries, available methods, parameters, example values, models, and status codes, and to try out the API.

Example creating shares#

The following request example includes both a JSON message request body and a curl request to share a component with a group.

JSON Request Message#

Copied to your clipboard
1{
2 "componentId": "{COMPONENTID}",
3 "componentType": "{COMPONENTTYPE}",
4 "shareToId": "{groupId}",
5 "shareToType": "group"
6}

curl Request#

Copied to your clipboard
1curl -X POST \
2 https://cja.adobe.io/componentmetadata/shares \
3 -H 'Accept: application/json' \
4 -H 'Authorization: Bearer {ACCESSTOKEN}' \
5 -H 'Content-Type: application/json' \
6 -H 'x-api-key: {API_KEY}' \
7 -H 'x-gw-ims-org-id: {IMS_ORG_ID}' \
8 -d '{REQUESTJSON}'

Example Response#

Copied to your clipboard
1{
2 "shareId": 12345,
3 "componentId": "{COMPONENTID}",
4 "componentType": "{COMPONENTTYPE}",
5 "shareToImsId": "{groupId}",
6 "shareToType": "group"
7}

Example deleting a share#

The following request example includes a curl request to delete a share.

curl Request#

Copied to your clipboard
1curl -X DELETE \
2 https://cja.adobe.io/componentmetadata/shares/{SHARE_ID} \
3 -H 'Accept: application/json' \
4 -H 'Authorization: Bearer {ACCESSTOKEN}' \
5 -H 'Content-Type: application/json' \
6 -H 'x-api-key: {API_KEY}' \
7 -H 'x-gw-ims-org-id: {IMS_ORG_ID}' \

The above curl command requests the following:

  • Delete share with id SHARE_ID and its association with other users/groups

Example Response#

Copied to your clipboard
1{
2 "shareId": {SHARE_ID},
3 "status": {
4 "success": true
5 }
6}

Example retrieving list of shares for a company#

The following request example includes a curl request to retrieve shares for current company.

curl Request#

Copied to your clipboard
1curl -X GET \
2 https://cja.adobe.io/componentmetadata/shares?page=0&limit=3 \
3 -H 'Accept: application/json' \
4 -H 'Authorization: Bearer {ACCESSTOKEN}' \
5 -H 'Content-Type: application/json' \
6 -H 'x-api-key: {API_KEY}' \
7 -H 'x-gw-ims-org-id: {IMS_ORG_ID}' \

The above curl command requests the following:

  • Retrieve specific page with query param page
  • Retrieve specific number of shares in a page with query param limit

Example Response#

Copied to your clipboard
1{
2 "content": [
3 {
4 "shareId": 2085535,
5 "shareToImsId": "{ims_user_id}",
6 "shareToType": "user",
7 "componentType": "segment",
8 "componentId": "s300006186_590cb8b9e4b0ca84fe8152b9",
9 "shareToDisplayName": null
10 },
11 {
12 "shareId": 11684455,
13 "shareToImsId": "{ims_group_id}",
14 "shareToType": "group",
15 "componentType": "segment",
16 "componentId": "s300006186_5f4eb5bc3f56a12f743e1405",
17 "shareToDisplayName": null
18 },
19 {
20 "shareId": 11684456,
21 "shareToType": "all",
22 "componentType": "segment",
23 "componentId": "s300006186_5f4eb5bb8aca3c5a990878e8",
24 "shareToDisplayName": null
25 }
26 ],
27 "totalPages": 38,
28 "totalElements": 113,
29 "number": 0,
30 "numberOfElements": 3,
31 "firstPage": true,
32 "lastPage": false,
33 "sort": null,
34 "size": 3
35}

Example retrieve shares for multiple components#

The following request example includes both a JSON message request body and a curl request to retrieve shares for multiple components of the same type.

JSON Request Message#

Copied to your clipboard
1{
2 "componentType": "segment",
3 "componentIds": [
4 "s300006186_5f4eb5bb8aca3c5a990878e8"
5 ]
6}

curl Request#

Copied to your clipboard
1curl -X POST \
2 https://cja.adobe.io/componentmetadata/shares/component/search?page=0&limit=3 \
3 -H 'Accept: application/json' \
4 -H 'Authorization: Bearer {ACCESSTOKEN}' \
5 -H 'Content-Type: application/json' \
6 -H 'x-api-key: {API_KEY}' \
7 -H 'x-gw-ims-org-id: {IMS_ORG_ID}' \
8 -d '{REQUESTJSON}'

The JSON message requests the following:

  • Retrieves all shares for component id s300006186_5f4eb5bb8aca3c5a990878e8 of type segment
  • Retrieve specific page with query param page
  • Retrieve specific number of shares in a page with query param limit

Example Response#

Copied to your clipboard
1{
2 "content": [
3 {
4 "componentType": "segment",
5 "componentId": "s300006186_5f4eb5bb8aca3c5a990878e8",
6 "shares": [
7 {
8 "shareId": 11684456,
9 "shareToImsId": "{ims_user_id}",
10 "shareToType": "user",
11 "componentType": "segment",
12 "componentId": "s300006186_5f4eb5bb8aca3c5a990878e8",
13 "shareToDisplayName": null
14 }
15 ]
16 }
17 ],
18 "totalPages": 1,
19 "totalElements": 1,
20 "number": 0,
21 "numberOfElements": 1,
22 "firstPage": true,
23 "lastPage": true,
24 "sort": null,
25 "size": 10
26}

Example retrieving components using shared to the user#

The following request example includes a curl request to retrieve a components of specific type associated with the user.

curl Request#

Copied to your clipboard
1curl -X GET \
2 https://cja.adobe.io/componentmetadata/shares/sharedto/me \
3 -H 'Accept: application/json' \
4 -H 'Authorization: Bearer {ACCESSTOKEN}' \
5 -H 'Content-Type: application/json' \
6 -H 'x-api-key: {API_KEY}' \
7 -H 'x-gw-ims-org-id: {IMS_ORG_ID}' \

Example Response#

Copied to your clipboard
1[
2 "s300006186_5f4eb5bb8aca3c5a990878e8"
3]

Example retrieving shares using id#

The following request example includes a curl request to retrieve a share with id.

curl Request#

Copied to your clipboard
1curl -X GET \
2 https://cja.adobe.io/componentmetadata/shares/{SHARE_ID} \
3 -H 'Accept: application/json' \
4 -H 'Authorization: Bearer {ACCESSTOKEN}' \
5 -H 'Content-Type: application/json' \
6 -H 'x-api-key: {API_KEY}' \
7 -H 'x-gw-ims-org-id: {IMS_ORG_ID}' \

Example Response#

Copied to your clipboard
1{
2 "shareId": 11684455,
3 "shareToImsId": "{ims_group_id}",
4 "shareToType": "group",
5 "componentType": "segment",
6 "componentId": "s300006186_5f4eb5bc3f56a12f743e1405",
7 "shareToDisplayName": null
8}

Update shares for components#

The following request example includes both a JSON message request body and a curl request to create and delete multiple shares associated with components.

Warning, this call is authoritative! Any shares not included in the request body will be deleted permanently!

JSON Request Message#

Copied to your clipboard
1[
2 {
3 "componentType": "segment",
4 "componentId": "s300006186_5f4eb5bb8aca3c5a990878e8",
5 "shares": [
6 {
7 "shareId": 11684456,
8 "shareToId": 622291,
9 "shareToType": "user",
10 "componentType": "segment",
11 "componentId": "s300006186_5f4eb5bb8aca3c5a990878e8",
12 "shareToDisplayName": null
13 }
14 ]
15 }
16]

The JSON message requests the following:

  • create a share to segment s300006186_5f4eb5bb8aca3c5a990878e8 for user 622291
  • if there are any preexisting shares associated with s300006186_5f4eb5bb8aca3c5a990878e8 then remove these associations.

curl Request#

Copied to your clipboard
1curl -X PUT \
2 https://cja.adobe.io/componentmetadata/shares \
3 -H 'Accept: application/json' \
4 -H 'Authorization: Bearer {ACCESSTOKEN}' \
5 -H 'Content-Type: application/json' \
6 -H 'x-api-key: {API_KEY}' \
7 -H 'x-gw-ims-org-id: {IMS_ORG_ID}' \
8 -d '{REQUESTJSON}'

Example Response#

Copied to your clipboard
1[
2 {
3 "componentType": "segment",
4 "componentId": "s300006186_5f4eb5bb8aca3c5a990878e8",
5 "shares": [
6 {
7 "shareToId": 622291,
8 "shareToType": "user",
9 "accessLevel": null
10 }
11 ],
12 "status": {
13 "success": true
14 }
15 }
16]
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.