Adding extra images to an item #1150
-
I'm using the API to create items and add data to them. I'm having no problem using the /api/items/{id}/image endpoint to upload the primary image for the item, but I also want to upload additional images as data of the item. I've tried so many things I can't even remember them all. From the API page, it appears that to load a data image, I need to:
I end up with an Image added to the item that has the correct label, but just the default template image, as opposed to the one I submitted in step 2. When I check the uploads folder, no new images were created. Any ideas what I'm doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Beta Was this translation helpful? Give feedback.
-
Ah, your last image showed me what I was doing wrong. I was still using "file" instead of "fileImage". Could you possibly show me the correct way to use the API to add a list to an item. When I try to send an array, it tells me it must be a string, when I format the array like a string (which is what I get when using GET on a list), it gives me a 201, but the entry is null. When I then try to navigate to the item in the web interface, I get the following: I can edit the item and see that the list was added and labeled correctly, but there are no list elements present. If I add at least one manually, the error in the image above goes away. |
Beta Was this translation helpful? Give feedback.
-
For lists the value must be a JSON valid string like |
Beta Was this translation helpful? Give feedback.
-
You got it. I just figured that out and came to post that, but you were a couple minutes ahead of me. Everything working now. Thank you so much. |
Beta Was this translation helpful? Give feedback.
Hello, the process is as you described. Maybe there is something missing in your data. Here's a working example:
1/ Create the data with
POST https://localhost:81/api/data
it should returns something like this