Have you retrieved the message that is sent with the 404? Try using Postman to do it manually and see it in more detail. It could be that you are missing a profile on the VS and it is complaining.
(tilda) notation is for URI encoding to avoid mixing up the BIG-IP partition/folder delimiter and URI’s slash. See also p. 13 of iControl REST User Guide Version 13.1. You should use the standard BIG-IP partition/folder notation (e.g. /Common/virtualX) in the payload.