title: Trying to stop Google Directory API push notifications with a client returns 404
body: <p>Using the documentation at <a href="https://developers.google.com/admin-sdk/directory/v1/guides/push#creating-notification-channels" rel="nofollow noreferrer">https://developers.google.com/admin-sdk/directory/v1/guides/push#creating-notification-channels</a> I subscribed to a notification using something like:</p>
  
  <pre class="lang-py prettyprint-override"><code>service = build('admin', 'directory_v1', credentials=credentials)
  watch_data = {
      'id': str(uuid.uuid1()),
      'type': 'web_hook',
      'address': 'https://example.appspot.com/push/user',
      'payload': True,
  }
  subscription = service.users().watch(domain=domain, event='update', body=watch_data).execute()
  # 'subscription' is stored
  </code></pre>
  
  <p>I got a proper reply and everything seem fine to that point.</p>
  
  <p>Until I try to stop the notification with the following code:</p>
  
  <pre class="lang-py prettyprint-override"><code># 'subscription' is retrieved from the storage
  service = build('admin', 'directory_v1', credentials=credentials)
  stop_data = {
      'id': subscription.id,
      'resourceId': subscription.resource_id
  }
  request = service.channels().stop(body=stop_data)
  request.execute()
  </code></pre>
  
  <p>This raises an 'HttpError' 404 exception:</p>
  
  <pre><code>Response: &lt;HttpError 404 when requesting https://www.googleapis.com/admin/directory/v1/admin/directory_v1/channels/stop? returned "Not Found"&gt;
  </code></pre>
  
  <p>Interestingly, using the same parameters (known good 'id' and 'resourceId' from the same user), the API explorer gadget at <a href="https://developers.google.com/admin-sdk/directory/v1/reference/channels/stop" rel="nofollow noreferrer">https://developers.google.com/admin-sdk/directory/v1/reference/channels/stop</a> fails in the same way.</p>
  
  <p>I've also been unable to find this endpoint in the full blown API explorer.</p>
  
  <p>I believe that the discovery somewhat misbehaves.</p>
  
  <p>The URI built by the client is:  '<a href="https://www.googleapis.com/admin/directory/v1/admin/directory_v1/channels/stop" rel="nofollow noreferrer">https://www.googleapis.com/admin/directory/v1/admin/directory_v1/channels/stop</a>'<br>
  whereas the documentation states it should be:<br>
  '<a href="https://www.googleapis.com/admin/directory/v1/channels/stop" rel="nofollow noreferrer">https://www.googleapis.com/admin/directory/v1/channels/stop</a>'.</p>
  
  <p>Could this be a bug in the API?</p>
  
  <p>I'll try to make a "manual" authenticated request ASAP to check this hypothesis.</p>
  
  <p><strong>Edit 2016-11-09:</strong></p>
  
  <p>Tried a manual request using the following code:</p>
  
  <pre class="lang-py prettyprint-override"><code># 'subscription' is retrieved from the storage
  stop_data = {
      'id': subscription.id,
      'resourceId': subscription.resource_id
  }
  http = httplib2.Http()
  http = credentials.authorize(http)
  url = 'https://www.googleapis.com/admin/directory/v1/channels/stop'
  method = 'POST'
  response, content = http.request(url, method, body=json.dumps(stop_data),
                                   headers={'content-type': 'application/json'})
  </code></pre>
  
  <p>I still get a 404 as a result. So I guess that the problem is not the endpoint URI.</p>
  
  <p>If someone from Google reads this, can you please look into it?</p>
  
  <p>It's not super critical but I'd like to not have dangling notification subscriptions.</p>
  
  <p><strong>Edit 2 2016-11-09:</strong></p>
  
  <p>Thanks to @Mr.Rebot for pointing out the reports API bug report.
  Upon closer inspection, the problem here is exactly the same.
  Using the manual request code above but adjusting the URI with an underscore, I'm finally able to make a successful request (returns 204).</p>
  
  <pre><code>url = 'https://www.googleapis.com/admin/directory_v1/channels/stop'
  </code></pre>
  
  <p>So there's definitely a bug somewhere and the following documentation pages have the wrong endpoint URI:</p>
  
  <ul>
  <li><a href="https://developers.google.com/admin-sdk/directory/v1/guides/push#stopping-notifications" rel="nofollow noreferrer">https://developers.google.com/admin-sdk/directory/v1/guides/push#stopping-notifications</a></li>
  <li><a href="https://developers.google.com/admin-sdk/directory/v1/reference/channels/stop" rel="nofollow noreferrer">https://developers.google.com/admin-sdk/directory/v1/reference/channels/stop</a></li>
  </ul>
  
  <p>Also found this related post: <a href="https://stackoverflow.com/questions/31735463/google-admin-sdk-channel-stop-endpoint-is-broken-in-client-libraries">Google Admin SDK Channel Stop endpoint is broken in client libraries</a></p>