Escape special characters in message for v2 API

When assembling the JSON for the v2 API request, make sure the special
characters "double quote" and "backslash" are properly escaped, to prevent
malformed JSON requests.
Fix argument validation for "From"

Don't require the "-f" argument if the API v2 is used, but only for v1.