-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Snipe-IT Version
v8.3.4 - build 20218 (master)
PHP Version
8.3.6
Composer Version
2.6.6
MySQL/MariaDB version
MariaDB 11.4.7
How did you install Snipe-IT?
Docker
Is this a fresh install or an upgrade?
Fresh install
What happened?
This endpoint seems to have inconsistent responses depending on the existence of the asset;
This is the output of the endpoint if the asset does not exist:
{
"status": "error",
"messages": "Asset does not exist.",
"payload": null
}
This is the output of the endpoint if the asset does exist (some random asset from the demo):
{
"id": 2595,
"name": "",
"asset_tag": "845905980",
"serial": "89fa4fd2-bad0-31b0-8a42-e984b480ef17",
"model": {
"id": 18,
"name": "Ultrasharp U2415"
},
"byod": false,
"requestable": true,
...
<snip>
As you can see, these two objects have two entirely different structures.
The 'exists' output does not have a status, nor does it have messages.
For the output to be consistent, either the 'exists' output should be the 'does not exist' output with a non-null 'payload' field (with a 'valid' status and an empty message), or the response should be empty if the object does not exist.
The reason I believe this is unintended is that as it is now, why have the payload field at all? The only time the payload field exists (null or otherwise) is if there is no payload.
For what it's worth, it's a minor issue. I understand that changing endpoint output is a breaking change, and you probably have higher priorities, but I think it's something to think about. It makes structuring API responses more difficult than it needs to be.
What browsers are you seeing the problem on?
No response
Can you reproduce this on the public demo?
Yes
Do you have full multiple company support enabled?
No
If you have full multiple company support enabled, do you have location scoping to company enabled?
I do not have full multiple company support enabled
Application log output
Browser console output
Common Issues
- I have searched this repo for existing issues related to my issue (including closed issues)
- My APP_URL is set correctly in my .env file (including http or https and no trailing slash)
- I have searched the official Snipe-IT documentation and have checked the Common Issues documentation (where applicable)
- I have run database migrations (where applicable).
- I have attached screenshots and/or videos of the issue (where applicable)
Code of Conduct
- I agree to follow this project's Code of Conduct