Can I programmatically add an Image to a Store product?

Getting an internal server error by using the update API mentioned in the documentation