title: RestTemplate GET request with request param
body: <p>I use RestTemplate for GET Request with requestParam as :</p>
  <pre><code>final String Url = &quot;http://localhost:8080/player/{nickname}&quot;;
      final Map&lt;String, String&gt; nickname = new HashMap&lt;String, String&gt;();
      nickname.put(&quot;nickname&quot;, score.getPlayer());
      String Uri = &quot;http://localhost:8081/game/{code}&quot;;
      final Map&lt;String, String&gt; code = new HashMap&lt;String, String&gt;();
      code.put(&quot;code&quot;, score.getGamecode());
      Player player = restTemplate.getForObject(Url, Player.class, nickname);
      Game game = restTemplate.getForObject(Uri, Game.class, code);
  </code></pre>
  <p>but I have an error</p>
  <pre><code>Connection refused
  </code></pre>
  <p>in the console
  and error:</p>
  <pre><code> &quot;I/O error on GET request for \&quot;http://localhost:8080/player/sahar1\&quot;: Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect&quot;
  </code></pre>
  <p>in the Postman</p>
  <p>could you help me how can I send GET request with requestParam?
  the POST method:</p>
  <pre><code>    @PostMapping
  public ResponseEntity&lt;?&gt; createScore(@RequestBody @JsonView(Views.class) @Valid  Score score) {
      final String Url = &quot;http://localhost:8080/player?nickname={nickname}&quot;;
      final Map&lt;String, String&gt; nickname = new HashMap&lt;String, String&gt;();
      nickname.put(&quot;nickname&quot;, score.getPlayer());
      String Uri = &quot;http://localhost:8081/game?code={code}&quot;;
      final Map&lt;String, String&gt; code = new HashMap&lt;String, String&gt;();
      code.put(&quot;code&quot;, score.getGamecode());
      Player player = restTemplate.getForObject(&quot;http://localhost:8080/player/&quot; + nickname, Player.class);
      Game game = restTemplate.getForObject(Uri, Game.class, code);
      if ((repo.findByScoreid(score.getScoreid())) == null) {
          if((player!= null) &amp;&amp; (game!=null)) {
              HashMap&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;();
              map.put(&quot;score&quot;, score.getScore());
              map.put(&quot;date&quot;, score.getDate());
              m = null;
              m.add(map);
              score.setHistory(m);
              repo.save(score);
          return ResponseEntity.status(201).body(&quot;Created!&quot;);
          }
          else return ResponseEntity.status(400).body(&quot;Bad Request!&quot;);
      }
      
      else
          return ResponseEntity.status(409).body(&quot;Conflict!&quot;);
      }
  }
  </code></pre>