You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[QUESTION] How to change part thumbnail with an existing one through API #6019
I'm developing a client desktop app to automate the digitalization of my inventory with InvenTree.
When I create a new part, instead of uploading an image, I'd like to select one of the existing thumbnails. This way the server have only one copy of a given image and when, from the web interface, I select an image among the existing ones, I get only unique images.
This is useful when creating parts for resistors, capacitors and other common components.
Since the InvenTree's API are fairly new to me, is there an API endpoint to do such a thing or should I open a feature request issue?
This is doable via a button in the the Classic UI. This fetches all images currently stored for the given model and allows you to choose one.
Disclaimer:
The below is just spitballing, based on what I know about the framework. It might work, it might not.
Looking quickly at the Part API endpoint, it looks as if you can supply an image string on POST requests. If this isn't meant to be a local path for upload, did you try to script this field to POST parts using the path your instance generates for the given image?
In theory, you could "upload"/move all the relevant images to the proper catalogue on the InvenTree server and then just reference the relative paths on your POST calls in the image field.
Activity
LavissaWoW commentedon Dec 1, 2023
This is doable via a button in the the Classic UI. This fetches all images currently stored for the given model and allows you to choose one.
Disclaimer:
The below is just spitballing, based on what I know about the framework. It might work, it might not.
Looking quickly at the Part API endpoint, it looks as if you can supply an image string on POST requests. If this isn't meant to be a local path for upload, did you try to script this field to POST parts using the path your instance generates for the given image?
In theory, you could "upload"/move all the relevant images to the proper catalogue on the InvenTree server and then just reference the relative paths on your POST calls in the image field.
SchrodingersGat commentedon Dec 2, 2023
@NidasioAlberto this will be addressed in #6021
You can (once the PR is merged) allow part image to be selected using "existing_image" field