Skip to content

[QUESTION] How to change part thumbnail with an existing one through API #6019

Closed

Description

@NidasioAlberto

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?

Activity

  1. LavissaWoW commented on Dec 1, 2023

    @LavissaWoW
    Contributor

    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.

  2. SchrodingersGat commented on Dec 2, 2023

    @SchrodingersGat
    Member

    @NidasioAlberto this will be addressed in #6021

    You can (once the PR is merged) allow part image to be selected using "existing_image" field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions