how to send a GET Parameter without value using makeWebRequest

Former Member
Former Member
is there a way to send a valueless GET Parameter like http://something?valuelessparameter

A dict with dict.put("valuelessparameter", null)

is sent as http://something?valuelessparameter=null


tested with SDK 2.6.2
  • Maybe try "" instead of null?
    Also, if I recall correctly, it might be things are a bit different based on the version of the SDK, so you may want to note which you are using.
  • Former Member
    Former Member
    no...a dict with dict.put("valuelessparameter", "")

    is sent as http://something?valuelessparameter=

    So, the "=" is still there.
  • Former Member
    Former Member
    Hi
    what about calling the URL http://something?valuelessparameter without anything as parameters ?
    Regards
  • Former Member
    Former Member
    Hi
    what about calling the URL http://something?valuelessparameter without anything as parameters ?
    Regards


    GarminConnect may add a trailling "?" to the URL. I had user who did see this behaviour. This leads to a wrong URL like http://something?param1?
    And this approach is somehow against the method specification... kind of dirty isn't it?

    I'm not sure!?
  • what about calling the URL http://something?valuelessparameter without anything as parameters ?

    This may work unless you need to add other parameters. If you need to pass other parameters, you'll get another question mark, which is likely to cause problems later.

    It might make sense to double-check the API that you are invoking. It is possible that they will accept the parameter without a value (a default is used), and you may specify a value if you want. In that case you'd just put valuelessparameter into the params map with an appropriate value.

    If that doesn't pan out, it may be best to write a service adapter that allows the device to make the request...

    http://adapterservice?parameter=valuelessparameter

    or, maybe better...

    http://adapterservice/valuelessparameter

    .. that would turn around and make the appropriate request...

    http://something?valuelessparameter

    The issue is that the query string that is part of the HTTP spec (and the URI spec) doesn't really define what the syntax is. It is usually key-value pairs, and the makeWebRequest() method expects to make requests that do it that way. I don't think it is unreasonable to file an enhancement request to update makeWebRequest() to handle a non-dictionary parameter passed in. In that case, the value provided would be encoded into the url immediately following the inserted ? symbol. Would that be sufficient to meet your needs?

    Travis