title: Using RestTemplate in Spring. Exception- Not enough variables available to expand
body: <p>I am trying to access the contents of an API and I need to send a URL using RestTemplate.</p>
  
  <pre><code>String url1 = "http://api.example.com/Search?key=52ddafbe3ee659bad97fcce7c53592916a6bfd73&amp;term=&amp;limit=100&amp;sort={\"price\":\"desc\"}";
  
  OutputPage page = restTemplate.getForObject(url1, OutputPage .class);
  </code></pre>
  
  <p>But, I am getting the following error.</p>
  
  <pre><code>Exception in thread "main" java.lang.IllegalArgumentException: Not enough variable values available to expand '"price"'
  at org.springframework.web.util.UriComponents$VarArgsTemplateVariables.getValue(UriComponents.java:284)
  at org.springframework.web.util.UriComponents.expandUriComponent(UriComponents.java:220)
  at org.springframework.web.util.HierarchicalUriComponents.expandInternal(HierarchicalUriComponents.java:317)
  at org.springframework.web.util.HierarchicalUriComponents.expandInternal(HierarchicalUriComponents.java:46)
  at org.springframework.web.util.UriComponents.expand(UriComponents.java:162)
  at org.springframework.web.util.UriTemplate.expand(UriTemplate.java:119)
  at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:501)
  at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:239)
  at hello.Application.main(Application.java:26)
  </code></pre>
  
  <p>If I remove the sort criteria, it is working  properly.
  I need to parse the JSON using sort criteria.
  Any help will be much appreciated.</p>
  
  <p>Thanks</p>