def transform_rest_request(self, orig_request, params, method_parameters):
request = orig_request.copy()<EOL>body_json = {}<EOL>for key, value in params.iteritems():<EOL><INDENT>body_json[key] = [value]<EOL><DEDENT>if request.parameters:<EOL><INDENT>for key, value in request.parameters.iteritems():<EOL><INDENT>if key in body_json:<EOL><INDENT>body_json[key] = value + body_json[key]<EOL><DEDENT>else:<EOL><INDENT>body_json[key] = value<EOL><DEDENT><DEDENT><DEDENT>for key, value in body_json.items():<EOL><INDENT>current_parameter = method_parameters.get(key, {})<EOL>repeated = current_parameter.get('<STR_LIT>', False)<EOL>if not repeated:<EOL><INDENT>body_json[key] = body_json[key][<NUM_LIT:0>]<EOL><DEDENT>body_json[key] = parameter_converter.transform_parameter_value(<EOL>key, body_json[key], current_parameter)<EOL>message_value = body_json.pop(key)<EOL>self._add_message_field(key, message_value, body_json)<EOL><DEDENT>if request.body_json:<EOL><INDENT>self._update_from_body(body_json, request.body_json)<EOL><DEDENT>request.body_json = body_json<EOL>request.body = json.dumps(request.body_json)<EOL>return request<EOL>
Translates a Rest request into an apiserving request.

        This makes a copy of orig_request and transforms it to apiserving
        format (moving request parameters to the body).

        The request can receive values from the path, query and body and combine
        them before sending them along to the backend. In cases of collision,
        objects from the body take precedence over those from the query, which in
        turn take precedence over those from the path.

        In the case that a repeated value occurs in both the query and the path,
        those values can be combined, but if that value also occurred in the body,
        it would override any other values.

        In the case of nested values from message fields, non-colliding values
        from subfields can be combined. For example, if '?a.c=10' occurs in the
        query string and "{'a': {'b': 11}}" occurs in the body, then they will be
        combined as

        {
          'a': {
            'b': 11,
            'c': 10,
          }
        }

        before being sent to the backend.

        Args:
          orig_request: An ApiRequest, the original request from the user.
          params: A dict with URL path parameters extracted by the config_manager
            lookup.
          method_parameters: A dictionary containing the API configuration for the
            parameters for the request.

        Returns:
          A copy of the current request that's been modified so it can be sent
          to the backend.  The body is updated to include parameters from the
          URL.