I'm using the Magento 2 rest API to read out the orders in to our system. If an order line product have a custom file option we want to download this file.
From the order items we get the following custom option result:
"option_value": "image/png,abu.png,custom_options/quote/a/b/2f25a9e4bb5afd53ad4e097c024289b6.png,custom_options/order/a/b/2f25a9e4bb5afd53ad4e097c024289b6.png,/var/www/html/magento2/pub/media/custom_options/quote/a/b/2f25a9e4bb5afd53ad4e097c024289b6.png,269733,651,718,2f25a9e4bb5afd53ad4e"
How can we download this file. The Magento backend uses the UUID and also a column id?
Question: How can you download a file uploaded by the user from the rest API?
1 Answer 1
You can get the information of the file exploding the "option_value", first element: File extension second element: File Name third: Download link (prepend: base_url + "media/")
eg: File extension: png File name: abu.png Download link: /media/custom_options/quote/a/b/2f25a9e4bb5afd53ad4e097c024289b6.png
Explore related questions
See similar questions with these tags.