diff --git a/src/ContentHubClient.php b/src/ContentHubClient.php index 407dd5ef..2a295311 100644 --- a/src/ContentHubClient.php +++ b/src/ContentHubClient.php @@ -1291,8 +1291,7 @@ public function addFilterToWebhook($filter_id, $webhook_id) { * @throws \Exception */ public function removeFilterFromWebhook($filter_id, $webhook_id) { - $options = ['body' => json_encode(['filter_id' => $filter_id])]; - $response = $this->delete("settings/webhooks/$webhook_id/filters", $options); + $response = $this->delete("filters/$filter_id/subscriptions/$webhook_id"); return self::getResponseJson($response); } diff --git a/test/ContentHubClientTest.php b/test/ContentHubClientTest.php index 37ae7a07..b23cb7aa 100644 --- a/test/ContentHubClientTest.php +++ b/test/ContentHubClientTest.php @@ -2465,8 +2465,8 @@ public function testRemoveFilterFromWebhookFailsIfWebhookNotExists(): void { $response = [ 'request_id' => 'some-request-uuid', 'error' => [ - 'code' => 4004, - 'message' => 'Webhook with the given uuid is not found.', + 'code' => 4001, + 'message' => 'filter is not registered for this account', ], 'success' => FALSE, ]; @@ -2474,7 +2474,7 @@ public function testRemoveFilterFromWebhookFailsIfWebhookNotExists(): void { $this->ch_client ->shouldReceive('delete') ->once() - ->with("settings/webhooks/{$webhook_id}/filters", ['body' => json_encode(['filter_id' => $filter_id])]) + ->with("filters/$filter_id/subscriptions/$webhook_id") ->andReturn($this->makeMockResponse(SymfonyResponse::HTTP_NOT_FOUND, [], json_encode($response))); $this->assertSame($this->ch_client->removeFilterFromWebhook($filter_id, $webhook_id), $response); @@ -2495,7 +2495,7 @@ public function testRemoveFilterFromWebhookSucceedsEvenIfFilterNotExists(): void $this->ch_client ->shouldReceive('delete') ->once() - ->with("settings/webhooks/{$webhook_id}/filters", ['body' => json_encode(['filter_id' => $filter_id])]) + ->with("filters/$filter_id/subscriptions/$webhook_id") ->andReturn($this->makeMockResponse(SymfonyResponse::HTTP_OK, [], json_encode($response))); $this->assertSame($this->ch_client->removeFilterFromWebhook($filter_id, $webhook_id), $response);