title: Using the Pivotal API in javascript
body: <p>I am new to using API's that have authentications, on the pivotal website they have commands using curl commands that look like this</p>
  
  <pre><code>export TOKEN='your Pivotal Tracker API token'
  
  curl -X GET -H "X-TrackerToken: $TOKEN" "https://www.pivotaltracker.com/services/v5/projects/99"
  </code></pre>
  
  <p>I was wondering how I can convert this to JavaScript by making a request, the problem is I don't know where to put the token when making the request to an API.</p>
  
  <p>So far in JavaScript I have this</p>
  
  <pre><code> function reqListener () {
        console.log(this.responseText);
      }
  
      var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
      var oReq = new XMLHttpRequest();
      oReq.addEventListener("load", reqListener);
  
      oReq.open("GET", "https://www.pivotaltracker.com/services/v5/projects/99?fields=version");
      oReq.setRequestHeader(header, 'Pivotal token');
      oReq.send();
  </code></pre>
  
  <p>Also i dont know what to in place of header.</p>