Adding choice of API version. Set $apiVersion to 1 or 2.