Update an installation

Azure Notification Hubs supports partial updates to an installation using the JSON-Patch standard in RFC6902.

Request

Method Request URI HTTP version
PATCH https://{namespace}.servicebus.windows.net/{NotificationHub}/installations/{id}?api-version=2015-01 HTTP/1.1

Request headers

The following table describes required and optional request headers.

Request header Description
Content-Type application/json-patch+json
Authorization SAS token generated as specified in Shared Access Signature Authentication with Service Bus.
x-ms-version 2015-01

Request body

The following patch operations are allowed:

JSON-Patch operation Installation Property Description and sample
add PushChannel Update the channel of an installation.

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

Put expiredPushChannel to true if pushChannel is changed.

add UserId Update or add user ID value.

[ { "op": "add", "path": "/userId", "value": "Bob"} ]

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, such as userID, 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.

Response

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

Response codes

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 headers

Response header Description
Content-type application/json-patch+json
Content-Location The location of the installation in the format: https://{namespace}.servicebus.windows.net/{NotificationHub}/installations/<installationId>

Response body

None.

See Also

Create or overwrite an installation
Read an installation
Delete an installation