Edit in GitHubLog an issue

Tags APIs

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

/componentmetadata/tags endpoint description#

The /componentmetadata/tags 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 tags#

The following request example includes both a JSON message request body and a curl request to create tags and associate them with existing components.

JSON Request Message#

Copied to your clipboard
1[
2 {
3 "name":"sales",
4 "description":"Sales Department",
5 "components":[
6 {
7 "componentType":"project",
8 "componentId":"component-id-1"
9 },
10 {
11 "componentType":"segment",
12 "componentId":"component-id-2"
13 }
14 ]
15 },
16 {
17 "name":"marketing",
18 "description":"Marketing Department",
19 "components":[
20 {
21 "componentType":"project",
22 "componentId":"component-id-101"
23 },
24 {
25 "componentType":"segment",
26 "componentId":"component-id-102"
27 }
28 ]
29 }
30]

The JSON message requests the following:

  • create two tags with description Sales Department and Marketing Department
  • associate Sales Department tag with components having ids component-id-1 and component-id-2
  • associate Marketing Department tag with components having ids component-id-101 and component-id-102

curl Request#

Copied to your clipboard
1curl -X POST \
2 https://cja.adobe.io/componentmetadata/tags \
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 "id":35632,
4 "name":"sales",
5 "description":"Sales Department",
6 "components":[
7 {
8 "componentType":"project",
9 "componentId":"component-id-1"
10 },
11 {
12 "componentType":"segment",
13 "componentId":"component-id-2"
14 }
15 ],
16 "status":{
17 "success":true
18 }
19 },
20 {
21 "id":35633,
22 "name":"marketing",
23 "description":"Marketing Department",
24 "components":[
25 {
26 "componentType":"project",
27 "componentId":"component-id-101"
28 },
29 {
30 "componentType":"segment",
31 "componentId":"component-id-102"
32 }
33 ],
34 "status":{
35 "success":true
36 }
37 }
38]

Example deleting a tag#

The following request example includes a curl request to delete a tag. It will also un-tag any/all components associated with the tag.

curl Request#

Copied to your clipboard
1curl -X DELETE \
2 https://cja.adobe.io/componentmetadata/tags/{TAG_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}' \
8 -d '{REQUESTJSON}'

The above curl command requests the following:

  • Delete tag with id TAG_ID and its association with other components

Example Response#

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

Example removing all tags from components#

The following request example includes a curl request to removes all tags from list of components.

curl Request#

Copied to your clipboard
1curl -X DELETE \
2 https://cja.adobe.io/componentmetadata/tags?componentIds={COMMA_SEPARATED_COMPONENT_IDS}&componentType={COMPONENT_TYPE} \
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 above curl command requests the following:

  • Removes all tags from list of component ids

Example Response#

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

Example retrieving list of tags for a company#

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

curl Request#

Copied to your clipboard
1curl -X GET \
2 https://cja.adobe.io/componentmetadata/tags?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 tags in a page with query param limit

Example Response#

Copied to your clipboard
1{
2 "content": [
3 {
4 "id": 596,
5 "name": "sales"
6 },
7 {
8 "id": 597,
9 "name": "marketing"
10 },
11 {
12 "id": 662,
13 "name": "finance"
14 }
15 ],
16 "numberOfElements": 3,
17 "totalElements": 385,
18 "totalPages": 129,
19 "firstPage": true,
20 "lastPage": false,
21 "sort": null,
22 "size": 3,
23 "number": 0
24}

Example retrieve tags for multiple components#

The following request example includes both a JSON message request body and a curl request to retrieve tags for multiple components.

JSON Request Message#

Copied to your clipboard
1{
2 "componentType": "project",
3 "componentIds": [
4 "component-id-556"
5 ]
6}

curl Request#

Copied to your clipboard
1curl -X POST \
2 https://cja.adobe.io/componentmetadata/tags/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 tags for component id component-id-556 of type project
  • Retrieve specific page with query param page
  • Retrieve specific number of tags in a page with query param limit

Example Response#

Copied to your clipboard
1{
2"content": [
3 {
4 "componentType": "project",
5 "componentId": "component-id-556",
6 "tags": [
7 {
8 "id": 35625,
9 "name": "finance",
10 "components": []
11 },
12 {
13 "id": 35624,
14 "name": "marketing",
15 "components": []
16 },
17 {
18 "id": 35626,
19 "name": "warehouse",
20 "components": []
21 }
22 ]
23 }
24],
25"totalElements": 1,
26"totalPages": 1,
27"number": 0,
28"numberOfElements": 1,
29"firstPage": true,
30"lastPage": true,
31"sort": null,
32"size": 10
33}

Example retrieving components using tags#

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

curl Request#

Copied to your clipboard
1curl -X GET \
2 https://cja.adobe.io/componentmetadata/tags/tagnames?tagNames={COMMA_SEPARATED_TAG_NAMES}&componentType={COMPONENT_TYPE} \
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 above curl command requests the following:

  • Get components associated with tags present in COMMA_SEPARATED_TAG_NAMES and of type COMPONENT_TYPE

Example Response#

Copied to your clipboard
1[
2 "component-id-1",
3 "component-id-2"
4]

Example retrieving tag using id#

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

curl Request#

Copied to your clipboard
1curl -X GET \
2 https://cja.adobe.io/componentmetadata/tags/{TAG_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 "id": 35632,
3 "name": "sales",
4 "description": "sales department",
5 "components": [
6 {
7 "componentType": "project",
8 "componentId": "component-id-1"
9 }
10 ]
11}

Example retrieving tags for a component of particular type#

The following request example includes a curl request to retrieve tags for a component of particular type.

curl Request#

Copied to your clipboard
1curl -X GET \
2 https://cja.adobe.io/componentmetadata/tags/search?componentId={COMPONENT_ID}&componentType={COMPOENT_TYPE} \
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 {
3 "id": 35653,
4 "name": "sales",
5 "description": "sales department",
6 "components": [
7 {
8 "componentType": "{COMPONENT_TYPE}",
9 "componentId": "{COMPONENT_ID}"
10 }
11 ]
12 },
13 {
14 "id": 35654,
15 "name": "finance",
16 "description": "finance department",
17 "components": [
18 {
19 "componentType": "{COMPONENT_TYPE}",
20 "componentId": "{COMPONENT_ID}"
21 }
22 ]
23 }
24]

Update tags for components#

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

JSON Request Message#

Copied to your clipboard
1[
2 {
3 "componentType":"project",
4 "componentId":"component-id-1",
5 "tags":[
6 {
7 "name":"marketing-1",
8 "description":"marketing 1"
9 },
10 {
11 "name":"marketing-2",
12 "description":"markerting 2"
13 }
14 ]
15 }
16]

The JSON message requests the following:

  • create two tags with description marketing-1 and marketing-2
  • associate marketing-1 and marketing-2 tag with components with ids component-id-1
  • if there are any preexisting tags associated with component-id-1 then remove these associations.

curl Request#

Copied to your clipboard
1curl -X PUT \
2 https://cja.adobe.io/componentmetadata/tags/tagitems \
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": "project",
4 "componentId": "component-id-1",
5 "tags": [
6 {
7 "id": 35653,
8 "name": "marketing-1",
9 "description": "marketing 1"
10 },
11 {
12 "id": 35654,
13 "name": "marketing-2",
14 "description": "marketing 2"
15 }
16 ],
17 "status": {
18 "success": true
19 }
20 }
21]
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.