Can WiFi settings be set or updated via the HTTP or JSON API?

I was wondering if it is possible to specify WiFi settings via the HTTP and/or JSON APIs? Clearly, this can be done via the web UI and the mobile apps but it would be great if that could also be done programmatically.

Has anyone tried this before?

Many thanks,