title: Unable to subscribe web-hook for SharePoint online
body: <p>We are unable to subscribe web-hook for SharePoint online from our Spring-Boot application.</p>
  <p>Providing valid notification URL(https enabled, publicly accessible, valid domain name, Post method)  as parameter while consuming rest API in order to subscribe web-hook.</p>
  <pre><code>    @PostMapping(value = &quot;/spnotification&quot;)
      @ResponseBody
      public ResponseEntity&lt;String&gt; handleSPValidation(@RequestParam final String validationtoken) {
          LOG.info(&quot;validationToken : &quot; + validationtoken);
          return ResponseEntity.ok().contentType(MediaType.TEXT_PLAIN)
                  .body(validationtoken);
      }
  
  </code></pre>
  <p>And on this notification URL end-point, we are able to receive validation string from share-point as parameter and same string we are retiring in less then 5 sec with content-type text/plain and http status code 200 as response.</p>
  <p>still getting 400 bad request with below error message.</p>
  <p><code>400 Bad Request: [{&quot;error&quot;:{&quot;code&quot;:&quot;-1, System.InvalidOperationException&quot;,&quot;message&quot;:{&quot;lang&quot;:&quot;en-US&quot;,&quot;value&quot;:&quot;Failed to validate the notification URL 'https://example.com/notification-listener-service/api/webhook/spnotification'.&quot;}}}]</code></p>
  <p><strong>Note :</strong> We are following this API <a href="https://docs.microsoft.com/en-us/sharepoint/dev/apis/webhooks/lists/create-subscription" rel="nofollow noreferrer">documentation</a> to subscribe web-hook.</p>
  <p>We tried <a href="https://docs.microsoft.com/en-us/graph/api/subscription-post-subscriptions?view=graph-rest-1.0&amp;tabs=http" rel="nofollow noreferrer">Graph API</a> also for the same purpose but in that case getting below error.</p>
  <pre><code>&quot;error&quot;: {
          &quot;code&quot;: &quot;InvalidRequest&quot;,
          &quot;message&quot;: &quot;The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF&quot;
         
      }
  </code></pre>
  <p>Please find this diagram for more understanding on this issue.</p>
  <p><a href="https://i.stack.imgur.com/XdGfq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XdGfq.png" alt="enter image description here" /></a></p>
  <p>We really appreciate if someone can help us on the same.</p>