code: private static String convertViewActionApiResponse(Format format, String name, ApiResponse res) throws ApiException {
  		switch (format) {
  		case JSON:
  			return res.toJSON().toString();
  		case JSONP:
  			return getJsonpWrapper(res.toJSON().toString());
  		case XML:
  			return responseToXml(name, res);
  		case HTML:
  			return responseToHtml(res);
  		default:
  			// Should not happen, format validation should prevent this case...
  			logger.error("Unhandled format: " + format);
  			throw new ApiException(ApiException.Type.INTERNAL_ERROR);
  		}
  	}
docs: Converts the given {@code ApiResponse} to {@code String} representation.
  <p>
  This is expected to be used just for views and actions.
  
  @param format the format to convert to.
  @param name the name of the view or action.
  @param res the {@code ApiResponse} to convert.
  @return the string representation of the {@code ApiResponse}.
  @throws ApiException if an error occurred while converting the response or if the format was not handled.
  @see #validateFormatForViewAction(Format)