Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoking multiple Get API(Syslog Destination, Email Event Subscription) with 'name' parameter giving exception of JSONDecodeError #156

Open
Abhishek-121 opened this issue Jun 14, 2024 · 0 comments

Comments

@Abhishek-121
Copy link

Abhishek-121 commented Jun 14, 2024

Prerequisites

  • [ yes] Have you tested the operation in the API directly?
  • [ yes] Do you have the latest SDK version?
  • [ yes] Review the compatibility matrix before opening an issue.

Describe the bug

I was working on the configuring and destination and notification and I came up with the issue that if in the Get API if we pass the filter parameter let say 'name' while invoking the Get Syslog Destination and with this name if no destination is present in the Catalyst Center then it will give response with status code 204 and the Exception message -

JSONDecodeError('Expecting value: line 1 column 1 (char 0)')

JSON_Decode_error

Problem is that the code in the dnacenter sdk attempted to decode an empty response body as JSON. Since the response status is 204 (No Content), this is expected behavior, but the code should handle it appropriately.

And there are multiple GET API calls having the same issue -

  1. Get Syslog Destination
  2. Get Syslog Subscription Details
  3. Get Syslog Event Subscription
  4. Get Rest/Webhook Subscriptions Details
  5. Get Rest/Webhook Event Subscriptions
  6. Get Email Subscriptions Details
  7. Get Email Event Subscriptions

Expected behavior
Expectation is when API give response status code as 204 then it should be handled in the code as this indicates the empty response and not need to decode the empty response as JSON and instead of giving Execption code should handle it and return None or empty response like we do in other GET API's (For Example - Get Device List API in devices.)

Environment (please complete the following information):

  • Cisco DNA Center Version and patch: 2.3.7.6-70200
  • Python version: 3.9
  • SDK version: 2.9.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant