REST URL with JSON parameters not working

REST URL with JSON parameters not working

  

I am trying to consume the following REST service:

https://1map.co.za/api/auth/login?json={"uname":"user@somewhere.co.za","upass":"mypassword"}

In the TEST panel I can successfully call the service using two parameters by specifying the following URL:

https://1map.co.za/api/auth/login?json=%7b"uname":"{userName}","upass":"{password}"%7d

Yet when I call the service from my application, it fails with error "400: Improperly formatted request"


I know I had a similar problem (see here) with google-maps {lat},{lon} parameters which I resolved by creating a single comma-delimited parameter but I can't get it right with this URL.


Even if I try setup the REST service with one parameter as:

https://1map.co.za/api/auth/login?json={parameters}

it fails with the same error when I URLEncode my parameter string to:

"%7b%22uname%22:%22user@somewhere.co.za%22,%22upass%22:%22mypassword%22%7d"


How can I consume this particular REST service that requires JSON strings in its URL?


I can't believe I tried this so many times and two minutes after I posted this it started working with a single parameter and a properly encoded URL as below.  I must have had something else wrong somewhere while testing.  Anyway - hopefully this will help anyone else with a similar issue.

https://1map.co.za/api/auth/login?json={parameters}

Use URLEncode() to set parameters to:

"%7b%22uname%22:%22user@somewhere.co.za%22,%22upass%22:%22mypassword%22%7d"