Query with '&' in the query value

Comments

5 comments

  • Avatar
    Mike O'Connor

    If I'm understanding correctly you can just put it in quotes so for example

    eval ('x=' + http.get('http://localhost:8082/database/BIRT/ordersByCustomer?cnum=' + sc.value + '&id=' + ID.value));

    0
    Comment actions Permalink
  • Avatar
    Jeff Sanchez

    Hello Mike,

    Thanks for the reply.  Lets look at it like this:

    eval ('x=' + http.get('http://localhost:8082/database/BIRT/ordersByCustomerName?name=' + name.value));

    In this example case name.value= 'John & Sons'

    If I capture the query given to sql, its just 'John'. If I encode the query value in the business rule, then the encoded string is given to the sql query. Although this can work, you have to decode, the value before running the query on the sql side. And unless Ive missed it ms sql does not have a decode function, meaning either a targeted replacement or building something in sql to do decoding.

    0
    Comment actions Permalink
  • Avatar
    Prajakta

    Hi Jeff,

    Could you try this:

    eval ('x=' + http.get('http://localhost:8082/database/BIRT/ordersByCustomerName?name="' + name.value + '"'));

     This will surround the value you are trying to pass with quotes. Maybe that will help?

     

    -Prajakta

     

     

    0
    Comment actions Permalink
  • Avatar
    Jeff Sanchez

    Hi.

    Will GET with a json payload work with the database connector?

    The docs seem to show that you can pass payload that way. But so far the db connector hasnt responded with results, just ok. The payload method with the above case, "&" works when used for PUT.

    0
    Comment actions Permalink
  • Avatar
    Prajakta

    Please see this documentation about HTTP methods in business rules. The http.get method does not accept JSON payload. You can only send headers with http.get.

    Thanks,

    Prajakta

    0
    Comment actions Permalink

Please sign in to leave a comment.