Part thumbnail with rest api

I’m having trouble linking an image file uploaded to the vault to the part thumbnail using the rest api. Does anyone know what the body of a patch request needs to be to set the image file_id as the thumbnail of a part?

Parents
  • I cannot tell you the exact body (cause it can have various formats..), but the thumbnail property behaves like every other regular property. So when you are able to edit the "description" or "name" of a Part, you should also be able to update the thumbnail.

    You just need to provide the correct string for the thumbnail. It contains the path to the codetree or vault directory. If you have a vaulted image, you need the file id.

    The content for your property looks something like this: vault:///?fileId=123ABCDEF....

    Angela

  • 0 オフライン in reply to AngelaIp

    Hi Angela 

    Thanks for the answer.  I think I have the correct body now, but maybe the problem is with the PATCH request in general. Any updates to a part I try to make fail with the response. 

    {
        "error": {
            "code": "BadRequest",
            "message": "An Error has occurred during creating entity."
        }
    }
    I've also followed this blog post https://aras.com/en/blog/tech-tip-using-the-aras-restful-api and everything works as expected except the PATCH request.
    I have switched to using the Innovator.Client library instead of the rest API as a solution, however I still would like to find a solution to my issue if possible. 
    I'm using a fresh installation of Aras Innovator Community Edition | 2024 Release.
    Kevin
  • The linked blog article is still fine, but maybe a bit dated.

    Have you included the aras.action inside the body?

    PATCH http://host/server/odata/Part(‘0486…23BC’)
    { "@aras.action": "edit", "item_number": "P-025" }

Reply Children