If this call is positive to same parameter inject a input box where the client can fill it.
The response of this call will be an encoded image (base64_encoded image) which will be replaced to the main image of the product.
Obviously the text entered in the input box must be added to the notes or to a custom field until checkout and then it will be saved in the order.
Is this possible?
Thanks in advace.
I think this is possible. The Shopify API has a ScriptTag section that explains how to run js on all pages. This would probably be where you insert a small js library that checks the URL (Shopify also has a Shopify object in js with some data, but doesn't look relevant to the product) or something to see which product it is. Then you could do any processing/injection you want.
While I think it's possible, I don't want to downplay the amount of work required. Maybe getting it to work for a single theme would be easy, but multiple themes could be very difficult.
If you just want to do this with a single store, you could edit the theme and manually include the JS in the product page. I don't know liquid that well, but I'm sure there are ways to inject the product ID, sku, or other data into a json field or variable.