Image Upload withREST API

Hi, I’m trying to upload some images with the following command but i get an error message all the time. Does anyone have any idea why?

Url like http://… not c filesystem

Rest Api works over http 

Hi Oliver,

 

but is there no way to upload an image stored on my computer?

Not with rest api. Put the files via ftp on webserver to upload.

1 „Gefällt mir“

There is a misunderstanding.

The information you are sending to your Api(Server) ist just an information (body) that will be read by the server and not by your home-Computer. So when the server reads that there is a link to C.  it does not know what to do cause it won’t have access to your computer neither it will have a C:-Drive

1 „Gefällt mir“

Thanks for the fast help but yes i think then i have a missunderstanding here. In The Admin Interface from the shop you can move to media and import media from my computer manually. So there must be a way to do that via http call without transfering them to a webserver first or am i wrong?

When you are using a website interface it is uploaded to the server via a underlaying html-formular. 

Hi brettvormkopp,

 

but there must be any way to upload an image which i have stored on my computer via API or not?

Ftp!

I understand that but we don’t have any ftp server to upload first and i can’t believe that there is no other way

Manual upload in the Backend

How could that be that in SW 5 it was possible to upload an image directly from a computer and in SW 6 not?

It is not possible via the Api. Wether SW5 nor SW6 can do it, nor any other Api on this world.

The concept is, that there is link to a public source for the hosting place of that image on any Server(public PC). Since your PC is not public you have to choose a server. Or you make your PC public with DDNS.

What is maybe possible is that you encode your Imagefile into a String, like base64. But iam unaware if this works with Shopware.

In the post request you can send the image as binary data.

just make the POST with content type image/png and body file_get_contents(c:/…)

According to REST API - Examples using the media resource it is possible via base64 for example. Haven’t tried though.