PAPI --- PUT /api-management/1.0/apis/{apiUuid}/tags doesn't work or adhere to spec?
search cancel

PAPI --- PUT /api-management/1.0/apis/{apiUuid}/tags doesn't work or adhere to spec?

book

Article ID: 228254

calendar_today

Updated On:

Products

CA API Developer Portal

Issue/Introduction

We are trying to get the  PUT /api-management/1.0/apis/{apiUuid}/tags endpoint to work like the Spec details, but I cannot seem to update an API that has no tags.

URL: https://apim-ssg.<portal_Domain>:9443/apim-nif/api-management/1.0/apis/3b7b4097-XXXX-XXXX-XXXX-XXXXXX/tags

Content-type: application/json; charset=UTF-8

Body:
[
{"name":"TAG1","uuid":"0268dc40-XXXXXXXXXXXXXX"},
{"name":"TAG2","uuid":"0396f135-XXXXXXXXXXXXXX"},
{"name":"TAG3","uuid":"07f8a930-XXXXXXXXXXXX"}
]

Response:

{
"error": {
"code""ValidationException",
"message": {
"lang""en",
"value""The request could not be completed due to data input errors."
        },
"detail": {
"errorCode""483",
"devErrorMessage""The request could not be completed due to data input errors.",
"userErrorMessage""The request could not be completed due to data input errors.",
"userErrorKey""error.validation.entity"
        }
    }
}
 

Environment

Release : 5.0.2

Component : API PORTAL

Cause

The body of the PUT to add the tags only needs the name of the tag 

Example TAG1

Resolution

 

Steps to ADD tag to API

Step 1 GET for UUID of the API to modify 

        {

            "uuid": "4d6a05a0-5d67-4db2-82e6-cbf47eba9896",

            "name": "MyAPI-1",

            "description": "Public note",

            "type": "BASIC",

            "portalStatus": "ENABLED",

            "accessStatus": "PUBLIC",

            "specFilename": null,

            "version": "1.0",

            "apiEulaUuid": "4e508b48-2xxxxxxxxxx",

            "createTs": 1633542355332,

            "modifyTs": 1633542376485,

            "ssgServiceType": "REST",

            "applicationUsage": 0,

            "tags": [],

            "publishedByPortal": true

        },

Step 2

Create two tags POST

https://apim-ssg.<portal_Domain>:9443/<tenantName>/tags

BODY

[

  {

    "name": "tag1",

    "uuid": "a689fa99-XXXXXXXXXXX"

  },

  {

    "name": "tag2",

    "uuid": "2bd6fcae-XXXXXXXXXXXXXX"

  }

]



Step 3

PUT to Add the first tag created

https://apim-ssg.<portal_Domain>:9443/<tenantName>/api-management/1.0/apis/4d6a05a0-5d67-4db2-82e6-cbf47eba9896/tags

 

BODY

[

 "tag1"

]

 

Results:

200 OK

 

Response Header

cache-control: no-cache, no-store, max-age=0, must-revalidate

content-length: 81

content-type: application/json;charset=utf-8

expires: 0

pragma: no-cache

 

Response Body

[

    {

        "name": "tag1",

        "uuid": "9a23cfb4-8790-42cb-9046-061fd167c1bb"

    }

]

Step 4 verify GET on APIS

GET https://apim-ssg.<portal_Domain>:9443/<tenantName>/api-management/1.0/apis

{

            "uuid": "4d6a05a0-5d67-4db2-82e6-cbf47eba9896",

            "name": "MyAPI-1",

            "description": "Public note",

            "type": "BASIC",

            "portalStatus": "ENABLED",

            "accessStatus": "PUBLIC",

            "specFilename": null,

            "version": "1.0",

            "apiEulaUuid": "4e508b48-2631-11ec-8933-fa163ec39b1c",

            "createTs": 1633542355332,

            "modifyTs": 1633542376485,

            "ssgServiceType": "REST",

            "applicationUsage": 0,

            "tags": [

                "tag1"

            ],

            "publishedByPortal": true

        }