Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-14163

Support for multiple request query parameters in Rest component

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.18.0
    • 3.0.0, 2.25.0
    • rest
    • None
    • Unknown

    Description

      The RestProducer doesn't have a way for specifying multiple query parameters. Given a header value that's a collection of values the resulting query parameter will be a joining of those values with the comma separator.

      Given that the query parameter can be specified multiple times, it is more common to have the parameter specified for each value of the collection rather than a single parameter with the coma-separated list of values.

      For example, endpoint URI of rest:GET:/v2/:pet/findByStatus and endpoint property queryParameters set to status={status}, and on the message header the status is a collection or array of values (e.g. ["available", "pending"]), the resulting URI path will be /v2/pet/findByStatus?status=available,pending.

      I think we could extemd the syntax of the placeholder (the {status}) to indicate that multiple query parameters should be provided instead of the coma-separated values.

      Perhaps something like status={status*} as we already have status={status?} to signify optional parameters. This would generate the URI path as /v2/pet/findByStatus?status=available&status=pending.

      Attachments

        Activity

          People

            zregvart Zoran Regvart
            zregvart Zoran Regvart
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: