snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
10.4k stars 3.06k forks source link

[Feature Request]: Kits and asset models on snipe-it homepage are not same over api access #14855

Open s681562 opened 3 weeks ago

s681562 commented 3 weeks ago

Is your feature request related to a problem? Please describe.

On homepage snipe-it I can call /kits for overviewing all kits. On homepage snipe-it I can call /kits/5 for overviewing the kit number 5 with all added asset models.

BUT

On api access via snipe-it I can call /api/v1/kits/5 for overviewing the kit number 5 but without all added asset models. There is no way to call /api/v1/kits/5 and see added asset models. There is no way to call to get the kit id over /api/v1/models.

Yes, i want to be clever, calling /api/v1/models, fetch all models and want to look up for kit id in each model section. BUT no way! The models listed as json contain no kit id.

This is a very missing feature!

Describe the solution you'd like

I want to call /api/v1/kits/5 (because my kit has id number 5) and I want to fetch all kits and attached models. (At the moment snipe-it support only attaching models to a kit. No idea, why. On the homepage it works, but as api call it does not work.

Describe alternatives you've considered

I tried to call /api/v1/models to figure out, which model has an connection to kit. But no model has a connection to a kit. But on homepage a kit has a list of models.

On homepage snipe-it I got a page with kit and models, but on direct Api call I see only simple kit json object without list of attached models.

Please review attached images (homepage and reqbin api call).

Additional context

KakaoTalk_20240612_105245824 KakaoTalk_20240612_105351177

welcome[bot] commented 3 weeks ago

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

snipe commented 3 weeks ago

Kits are kind of a mess if I'm completely honest. Once we release v7 on Monday, we'll be re-thinking a lot of the way they work, I think.

s681562 commented 3 weeks ago

I found out, that there is a list with kit and there models. (number 5 is the ID of my kit)

/api/v1/kits/5/models (this is not official in documentation).

But from now it is impossible to get all assets related to a model.

Number 21 is my model ID 21. Homepage /models/21 give you a list of all related assets 10034, 10035, 10036

But /api/v1/models/21 give you only a short json object.

{ "id": 21, "name": "Stuhl", "manufacturer": null, "image": null, "model_number": "", "min_amt": null, "depreciation": null, "assets_count": 3, "category": { "id": 13, "name": "Auswahlmodul " },...

That's all. No related asset overview like Homepage call.

Further question: How to get models assets hardware? Yes... assets is linked to a hardware (i can not explain).

s681562 commented 3 weeks ago

Kits are very helpful.

We are using Kits for bundle a set of assets with min, max, current available items. So we can present several kits to our customer. Customer should choose between min and max and available counter should go up and down. But until now I did not found a way to express this use case and there is no way to see this kits - model - asset relation over api access. How to evaluate the current amount of available assets models? A kit goes to several customers and I have no idea, how to store the number of taken assets from each. I understand the kit - asset relation as menu card. Customer can take min to max order from this card. But I don't know how to store the current amount of order from an asset taken by customer. Maybe there is a custom field where I can store user-id and counter of taken asset. And the custom field should be inside a kit.