(assertion fix) TypeError while raising APIError

APIError constructor includes two named keyword arguments and kwargs.

If json.loads returns something other than a dict, api.py tries
to raise an APIError exception passes a third unnamed argument to the
constructor, causing a TypeError exception to be raised.

Change-Id: Ieb7741d5737e6b0ad84b188b914f30411cdf0924
Merge "(assertion fix) TypeError while raising APIError"