Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Erstellt eine neue Registrierung. Diese Methode generiert eine Registrierungs-ID, die Sie anschließend verwenden können, um diese Registrierung abzurufen, zu aktualisieren und zu löschen.
Anforderung
| Methode | Anforderungs-URI | HTTP-Version |
|---|---|---|
| POST | https://{namespace}.servicebus.windows.net/{NotificationHub}/registrations/?api-version=2015-01 |
HTTP/1.1 |
Anforderungsheader
In der folgenden Tabelle werden erforderliche und optionale Anforderungsheader beschrieben.
| Anforderungsheader | BESCHREIBUNG |
|---|---|
| Content-Type | application/atom+xml;type=entry;charset=utf-8 |
| Authorization | SAS-Token generiert, wie unter Shared Access Signature Authentication with Service Bus angegeben. |
| x-ms-version | 2015-01 |
Anforderungstext
Atom-Eintrag mit der im Inhalt eingebetteten Beschreibung. Es folgen einige Beispiele.
Native Registrierung für Windows Notification Service:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<WindowsRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<Tags>myTag, myOtherTag</Tags>
<ChannelUri>{ChannelUri}</ChannelUri>
</WindowsRegistrationDescription>
</content>
</entry>
Hinweis
Das Tags-Element ist optional.
Vorlagenregistrierung für Windows Notification Service:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<WindowsTemplateRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<Tags>myTag, myOtherTag</Tags>
<ChannelUri>{ChannelUri}</ChannelUri>
<BodyTemplate><![CDATA[{Template for the body}]]></BodyTemplate>
<WnsHeaders>
<WnsHeader>
<Header>X-WNS-Type</Header>
<Value>wns/tile</Value>
</WnsHeader>
<WnsHeader>
<Header>X-WNS-Tag</Header>
<Value>myTag</Value>
</WnsHeader>
</WnsHeaders>
</WindowsTemplateRegistrationDescription>
</content>
</entry>
Hinweis
Das BodyTemplate-Element ist obligatorisch, ebenso wie der X-WNS-Type-Header.
Native Registrierung für Apple Push Notification Service:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<AppleRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<Tags>myTag, myOtherTag</Tags>
<DeviceToken>{DeviceToken}</DeviceToken>
</AppleRegistrationDescription>
</content>
</entry>
Hinweis
Das Tags-Element ist optional.
Vorlagenregistrierung für Apple Push Notification Service:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<AppleTemplateRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<Tags>myTag, myOtherTag</Tags>
<DeviceToken>{DeviceToken}</DeviceToken>
<BodyTemplate><![CDATA[{Template for the body}]]></BodyTemplate>
<Expiry>{Template for Expiry in }</Expiry>
</AppleTemplateRegistrationDescription>
</content>
</entry>
Hinweis
Das BodyTemplate-Element ist obligatorisch. Der Ablauf ist optional.
Native Registrierung für Firebase Cloud Messaging:
// FcmV1Registration
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<FcmV1RegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<Tags>myTag, myOtherTag</Tags>
<FcmV1RegistrationId>{deviceToken}</FcmV1RegistrationId>
</FcmV1RegistrationDescription>
</content>
</entry>
Native Registrierung für Google Cloud Messaging:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<GcmRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<Tags>myTag, myOtherTag</Tags>
<GcmRegistrationId>{GCM Registration Id}</GcmRegistrationId>
</GcmRegistrationDescription>
</content>
</entry>
Hinweis
Das Tags-Element ist optional.
Vorlagenregistrierung für Firebase Cloud Messaging:
// FcmV1TemplateRegistration
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<FcmV1TemplateRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<Tags>myTag, myOtherTag</Tags>
<FcmV1RegistrationId>{deviceToken}</FcmV1RegistrationId>
<BodyTemplate><![CDATA[ {BodyTemplate}]]></BodyTemplate>
</FcmV1TemplateRegistrationDescription>
</content>
</entry>
Vorlagenregistrierung für Google Cloud Messaging:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<GcmTemplateRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<Tags>myTag, myOtherTag</Tags>
<GcmRegistrationId>{GCM Registration Id}</GcmRegistrationId>
<BodyTemplate><![CDATA[ {BodyTemplate}]]></BodyTemplate>
</GcmTemplateRegistrationDescription>
</content>
</entry>
Hinweis
Das BodyTemplate-Element ist obligatorisch.
Native Registrierung für Microsoft Push Notification Service:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<MpnsRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<Tags>myTag, myOtherTag</Tags>
<ChannelUri>{ChannelUri}</ChannelUri>
</MpnsRegistrationDescription>
</content>
</entry>
Hinweis
Das Tags-Element ist optional.
Vorlagenregistrierung für Microsoft Push Notification Service:
<?xml version="1.0" encoding="utf-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<content type="application/xml">
<MpnsTemplateRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<Tags>myTag, myOtherTag</Tags>
<ChannelUri>{ChannelUri}</ChannelUri>
<BodyTemplate><![CDATA[{Template for the body}]]></BodyTemplate>
<MpnsHeaders>
<MpnsHeader>
<Header>X-WindowsPhone-Target</Header>
<Value>toast</Value>
</MpnsHeader>
<MpnsHeader>
<Header>X-NotificationClass</Header>
<Value>[batching interval]</Value>
</MpnsHeader>
</MpnsHeaders>
</MpnsTemplateRegistrationDescription>
</content>
</entry>
Hinweis
Das BodyTemplate-Element ist obligatorisch, ebenso wie der X-WindowsPhone-Target-Header.
Antwort
Die Antwort enthält den HTTP-Statuscode und einen Satz von Antwortheadern.
Antwortcodes
| Code | BESCHREIBUNG |
|---|---|
| 201 | Registrierung erfolgreich erstellt. |
| 400 | Ungültiger Anfragetext. Die Registrierung konnte nicht erstellt werden, da die Anforderung fehlerhaft war. |
| 401 | Autorisierungsfehler Der Zugriffsschlüssel war falsch. |
| 403 | Kontingent überschritten; zu viele Registrierungen in diesem Namespace. Registrierung nicht erstellt. |
| 403 | Die Anforderung wurde abgelehnt, weil die Registrierungsvorgänge zu hoch sind. |
Informationen zu status Codes finden Sie unter Status- und Fehlercodes.
Antwortheader
| Antwortheader | BESCHREIBUNG |
|---|---|
| Inhaltstyp | application/atom+xml;type=entry;charset=utf-8 |
| ETag | {weak ETag} |
Antworttext
Bei Erfolg wird ein überprüfter Atom-Eintrag zurückgegeben. Sie enthält schreibgeschützte Elemente wie ETag, RegistrationId und ExpirationTime. Beispiel:
<entry>
<id>https://{tenant}.servicebus.windows.net/{NotificationHub}/registrations/{registrationId}</id>
<title type="text"> /{NotificationHub}/registrations/{registrationId}</title>
<updated>2012-08-17T17:32:00Z</updated>
<metadata:etag>{weak Etag}</metadata:etag>
<content type="application/xml">
<WindowsRegistrationDescription xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
<ETag>{ETag}</ETag>
<ExpirationTime>2012-07-16T19:20+01:00</ExpirationTime>
<RegistrationId>{RegistrationId}</RegistrationId>
<Tags>myTag, myOtherTag</Tags>
<ChannelUri>{ChannelUri}</ChannelUri>
</WindowsRegistrationDescription>
</content>
</entry>