Enhancements related to API workflow sharing.

Add ability to specify  and  when uploading new workflows via the API. Implement tests of this ability and use it to test importing shared workflows (recently added by Nicola). Small improvements to shared import exception handling.
A few a more fairly generic API exceptions, error codes.
Rework workflows API to use new decorator.

Use more helper methods to reduce method length, duplication. Improved testing, exception handling.