X-WNS-Match for notification delete

In according with this, we can send a X-WNS-Match notification to delete app’s notification in action center in various ways:  all, group, single (with tag) or both.

NOTE: We need also to change the request method from default “POST” to “DELETE” and set ContentType to None.

So, when we’ll set the X_WNS_Match property, in every case (except "all"), we need also to pass the TAG\GROUPS ID.

Let’s see an example for All

$tok = GetToken();
$cha = GetNewChannel();
$Options = new WindowsNotification\WNSNotificationOptions();
$Options->SetAuthorization(new WindowsNotification\OAuthObject($tok));
//SET X-WNS-Match to all
$Options->SetX_WNS_MATCH(WindowsNotification\X_WNS_Match::All);
//Set X-WNS-Type to none
$Options->SetX_WNS_TYPE(WindowsNotification\X_WNS_Type::None);
//Set content type to none
$Options->SetContentType(WindowsNotification\Content_Type::None);
$Notifier = new WindowsNotification\WindowsNotificationClass($Options);
$Notifier->Send($cha,null,WindowsNotification\HTTPMethod::Delete));

How you can see, it’s simple to send a notification for All.

For Group\Tag\Both we need to pass an array to "SetX_WNS_MATCH" method while the other code is always the same.

 

Tag

$Options->SetX_WNS_MATCH(WindowsNotification\X_WNS_Match::Tag,array("tag" => "value"));

Group

$Options->SetX_WNS_MATCH(WindowsNotification\X_WNS_Match::Group,array("group" => "value"));

Both

$Options->SetX_WNS_MATCH(WindowsNotification\X_WNS_Match::TagAndGroup,array("group" => "grvalue","tag" => "tagvalue"));

 

REMEMBER: Set always in the Options the Content-Type to None and when you perform the send, you need to pass the HTTPMethod::Delete (it is “DELETE” verb in HTTP header)

Last edited May 16, 2015 at 4:39 PM by Andreabbondanza, version 5