tag.py def updates_tag_membership incorrectly requires a List for memberToTags
Opened this issue · 0 comments
cottersb commented
Prerequisites
- Have you tested the operation in the API directly?
- Do you have the latest SDK version?
- Review the compatibility matrix before opening an issue.
Describe the bug
updates_tag_membership in 2.3.5.3 and prior versions is looking for a List for the variable memberToTags.
Expected behavior
This is incorrect as API calls are expecting an Object not a List.
Screenshots
2.3.5.5:
Non-working:
{
"memberToTags": [
{
"220ca4a4-66cd-4559-a1e0-a1b8b7e6f27d": [
"376ad2f5-2361-4616-ad44-360fb4938126",
"5390a6a6-0c29-4711-8cd9-99ce48503434",
"7b2acb8e-1c67-432d-96b7-96058ceb3957"
]
}
],
"memberType": "template"
}
{
"response": {
"errorCode": "BadRequest",
"message": "Input data is not in proper format",
"detail": "Input data is invalid"
},
"version": "1.0"
}
Working:
{
"memberToTags": {
"220ca4a4-66cd-4559-a1e0-a1b8b7e6f27d": [
"376ad2f5-2361-4616-ad44-360fb4938126",
"5390a6a6-0c29-4711-8cd9-99ce48503434",
"7b2acb8e-1c67-432d-96b7-96058ceb3957"
]
},
"memberType": "template"
}
{
"response": {
"taskId": "8c0e9a5a-1eb7-472b-8840-f4fd2cc6f56d",
"url": "/api/v1/task/8c0e9a5a-1eb7-472b-8840-f4fd2cc6f56d"
},
"version": "1.0"
}
Environment (please complete the following information):
- Cisco DNA Center Version and patch: 2.3.5.5
- Python version: 3.11.2
- SDK version:
pip list
Package Version
------------------ --------
certifi 2024.2.2
charset-normalizer 3.3.2
dnacentersdk 2.6.11
fastjsonschema 2.19.1
future 0.18.3
idna 3.7
pip 23.0.1
requests 2.32.3
requests-toolbelt 1.0.0
setuptools 66.1.1
urllib3 2.2.1
- OS Version:
cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
Additional context
This appears to be fixed in the 2.3.7.6 portion of the SDK based on the code changes I see but haven't tested. Fix should be back ported to previous versions.
dnacentersdk/api/v2_3_7_6/tag.py
def update_tag_membership(self,
memberToTags=None,
memberType=None,
headers=None,
payload=None,
active_validation=True,
**request_parameters):
"""Update tag membership. As part of the request payload through this API, only the specified members are added /
retained to the given input tags. Possible values of memberType attribute in the request payload can be
queried by using the /tag/member/type API .
Args:
memberToTags(object): Tag's memberToTags.