-
I have an existing spare parts database that I would like to migrate to part-db. Request body: {
"name": "Vorschaubild1",
"element": {
"name": "Vorschaubild1"
},
"url": "/media/import/rc_part_image_00a10f6a-0e0e-41c3-94ad-3eadbbafdc3d.png"
} Response body: {
"@context": "/api/contexts/Error",
"@id": "/api/errors/500",
"@type": "hydra:Error",
"title": "An error occurred",
"detail": "Cannot instantiate abstract class App\\Entity\\Attachments\\Attachment",
"status": 500,
"type": "/errors/500",
"hydra:title": "An error occurred",
"hydra:description": "Cannot instantiate abstract class App\\Entity\\Attachments\\Attachment"
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
There currently is no way to upload files via the API and for security reason it is not possible to modify the underlying file pathes directly. I guess the easiest approach would be to directly manipulating the database and adding new rows in the attachment table. |
Beta Was this translation helpful? Give feedback.
-
It is now possible to upload files via the API. 🥳 In order to connect the images to the parts, the parts must be favorite and have an IPN whose number is the same as the file name in the images subfolder. E.g. IPN = EBN10 File name = Image_10.jpg The ID of the attachment_type is 1002. But everything can also be adjusted in the script. Caution Make a backup before use!
|
Beta Was this translation helpful? Give feedback.
I have successfully edited the database to add the preview images. Using the HeidiSQL software, I was able to easily export the attachments table as a CSV and add the new attachments in Excel. I then imported the table again. I made two errors on my first try. By editing in Excel, the date format for the entries was no longer correct and I had to restore the Linux permission of the database file for the user www-data. Thanks for your support.