title: Sending Post request to Gerrit REST API from javascript
body: <p>I'm working ok an Chrome Extension to improve Gerrit Experience. For that I'm using <a href="https://gerrit-documentation.storage.googleapis.com/Documentation/2.12.1/index.html" rel="nofollow noreferrer">Gerrit REST API</a> with <a href="https://github.com/marmelab/restful.js/tree/0.7" rel="nofollow noreferrer">restful.js</a>.</p>
  
  <p>For all requests where anonymous access was allowed that method work pretty fine. But I could not perform a POST request, to submit a review for example.</p>
  
  <p>Please, consider this code:</p>
  
  <pre><code>api = restful(options.gerritUrl).prefixUrl(options.prefix);
  var obj = {"labels":{"Code-Review":2},"strict_labels":true,"drafts":"PUBLISH_ALL_REVISIONS"};
  api.all("a/changes/{id}/revisions/{revision}/review/").post(obj)
     .then(function(response){
          console.log(response)
      })
     .catch(function (error) {
          console.log(error)
      })
  </code></pre>
  
  <p>I always get an 403 error saying:</p>
  
  <blockquote>
    <p>Invalid authentication method. In order to authenticate, prefix the REST endpoint URL with /a/ (e.g. <a href="http://example.com/a/projects/" rel="nofollow noreferrer">http://example.com/a/projects/</a>).</p>
  </blockquote>
  
  <p>But as you can see I'm already using <code>a/changes</code> as required.</p>
  
  <p>Debugging a real request made by an user interaction I can see a <code>X-Gerrit-Auth</code> property on header. But I could not find any specification on how to find it or how to use it on a request</p>