/** * Sends a request to the API gateway for deleting a group. * * @param string $groupId group id to delete * * @return void * @throws ServiceException if request was not successful */ public function deleteGroup($groupId) { $groupId = urlencode($groupId); $endpoint = $this->getFqdn() . "/addressBook/v1/groups/{$groupId}"; $req = new RestfulRequest($endpoint); $req->setAuthorizationHeader($this->getToken())->setHeader('Accept', 'application/json')->setHeader('Content-Type', 'application/json'); $result = $req->sendHttpDelete(); $code = $result->getResponseCode(); if ($code != 204) { throw new ServiceException($result->getResponseBody(), $code); } }
public function deleteMessage($msgId) { $endpoint = $this->getFqdn() . '/myMessages/v2/messages/' . $msgId; $req = new RestfulRequest($endpoint); $req->setHeader('Accept', 'application/json')->setAuthorizationHeader($this->getToken()); $result = $req->sendHttpDelete(); if ($result->getResponseCode() != 204) { $body = $result->getResponseBody(); throw new ServiceException($result->getResponseCode(), $body); } }
public function deleteNotificationSubscription($channelId, $subscriptionId) { $channelId = urlencode($channelId); $subscriptionId = urlencode($subscriptionId); $suburl = '/notification/v1/channels/' . $channelId . '/subscriptions/'; $suburl = $suburl . $subscriptionId; $endpoint = $this->getFqdn() . $suburl; $req = new RestfulRequest($endpoint); $req->setAuthorizationHeader($this->getToken()); $result = $req->sendHttpDelete(); $code = $result->getResponseCode(); $body = $result->getResponseBody(); if ($code != 204) { throw new ServiceException($body, $code); } return $result->getHeader('x-systemTransactionId'); }