Officially, you can’t. This is something that’s been discussed numerous times in the past. Here are just two previous discussions:
https://community.wd.com/t/using-my-mycloud-to-host-my-blog-photos/155738
https://community.wd.com/t/direct-link/145919
Unofficially it may be possible, but it may only work on certain firmware versions of the My Cloud and typically would require one to hack the My Cloud firmware using SSH.
https://community.wd.com/t/how-to-use-wd-my-cloud-for-image-hosting/95460