title: How to replace path parameter in URL NodeJS
body: <p><strong>Problem Statement:</strong> To replace path parameter in URL before making a call to API in NodeJS(Javascript) based API automation framework.</p>
  
  <p><em>Given URL:</em> <code>https://api.spotify.com/v1/albums/{id}</code></p>
  
  <p><code>{id}</code> needs to be replaced with value <code>Sunshine</code></p>
  
  <p><strong>Expected URL:</strong>  <code>https://api.spotify.com/v1/albums/Sunshine</code></p>
  
  <p>I have seen certain questions in StackOverflow. But they are more related to replace <code>query_params</code> value but not to replace <code>path_params</code>.</p>
  
  <p>I am trying to do with this approach, but this code does not work.</p>
  
  <pre><code>var href = new URL('https://api.spotify.com/v1/albums/{id}');
  href.searchParams.set('{id}', 'Sunshine');
  console.log(href.toString());
  </code></pre>
  
  <p>Any help to let me know how to do this would be of great help.</p>