code: function (defer, response) {
                  var error = response.error;
                  if (error) {
                      defer.reject(new ApiError(error.type, error.message, error.data));
                  } else {
                      defer.resolve(response.data);
                  }
              }
docs: Resolve deferred promise.
  
  @param {vow.Deferred} defer
  @param {Object} response Server response.