Update Installations by User or Advertising ID

 

Azure Notification Hubs supports partial updates to all installations for the specified user or advertising ID using the JSON-Patch standard in RFC6902.

Method

Request URI

HTTP version

PATCH

https://{namespace}.servicebus.windows.net/{NotificationHub}/installations/patchByUser?UserId={userid}

HTTP/1.1

PATCH

https://{namespace}.servicebus.windows.net/{NotificationHub}/installations/patchByAdvertisingId?AdvertisingId={advertisingid}

HTTP/1.1

The following table describes required and optional request headers.

Request Header

Description

Content-Type

application/json-patch+json

Authorization

Token generated as specified in Shared Access Signature Authentication with Service Bus, or Service Bus authentication and authorization with Microsoft Azure Active Directory Access Control (also known as Access Control Service or ACS).

x-ms-version

2015-01

The following patch operations are allowed:

System_CAPS_noteNote

Partial update for PushChannel is not supported by this method. It is supported by Update Installation by Installation ID.

JSON-Patch operation

Installation Property

Description and sample

add

User/AppId/AdvertisingId

Update or add user, AppId, AdvId value.

[ { "op": "add", "path": "/user", "value": "elio"} ] 

add

Tag

If value is array, add all tags in array to existing tags (even if not present). If value is a string, add tag to current array (or create a new array with single value, if not tags are currently present).

[ { "op": "add", "path": "/tags", "value": "tag"} ]

add

Template (P2)

Update or add whole template.

[ { "op": "add", "path": "/templates/myTemplate", "value": '{"body": "…", "tags": ["tag"]}'} ]

add

Template body/header/expiry/tags

Update or add parts of template (note that ‘add’ on headers replaces current headers object). Add on tags has the same semantics as native tags.

[ { "op": "add", "path": "/templates/myTemplate/body", "value": '{"aps": …}'} ]
[ { "op": "add", "path": "/templates/myTemplate/headers", "value": '{"X-WNS-Type": "wns/toast"}'} ]

add

secondaryTile channel

Updates the secondaryTile channel.

[ { "op": "add", "path": "/secondaryTiles/myTile/pushChannel", "value": "aaaaaaa"} ]

add

secondaryTile tag

Same as tags update but path refers to secondary tile.

[ { "op": "add", "path": "/secondaryTiles/myTile/tags", "value": '["fooTag"]'} ]

add

secondaryTile template

Same as normal templates but path refers to tileId.

add

secondaryTile template body/header/expiry/tags

Same as normal templates but path refers to tileId.

Remove

As above

Deletes a property or an element of the tags array. If the last tag of the tags property is removed the whole property is removed.

[ { "op": "remove", "path": "/tags/myTag"} ]

Replace

As above

Semantically equivalent to remove+add.

The response includes an HTTP status code and a set of response headers.

Code

Description

204

The installation was patched successfully

400

The installation could not be patched because the request was malformed.

401

Authorization failure. The access key was incorrect.

403

Quota exceeded; too many registrations in this namespace. Registration not created.

403

Request rejected because API call rate is too high.

For information about status codes, see Status and Error Codes.

Response Header

Description

Content-type

application/json-patch+json

Show: