다음을 통해 공유


등록 만들기

새 등록을 만듭니다. 이 메서드에서 생성하는 등록 ID를 사용하여 나중에 해당 등록을 검색하고 업데이트하고 삭제할 수 있습니다.

요청

메서드 요청 URI HTTP 버전
POST https://{namespace}.servicebus.windows.net/{NotificationHub}/registrations/?api-version=2015-01 HTTP/1.1

요청 헤더

다음 표에서는 필수 요청 헤더와 선택적 요청 헤더에 대해 설명합니다.

요청 헤더 Description
콘텐츠 형식 application/atom+xml;type=entry;charset=utf-8
권한 부여 Service Bus를 사용한 공유 액세스 서명 인증에 지정된 대로 생성된 SAS 토큰입니다.
x-ms-version 2015-01

요청 본문

내용에 설명이 포함된 ATOM 항목입니다. 몇 가지 예제는 다음과 같습니다.

Windows 알림 서비스에 대한 기본 등록:

<?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>

참고

Tags 요소는 선택 사항입니다.

Windows 알림 서비스에 대한 템플릿 등록:

<?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>

참고

BodyTemplate 요소는 X-WNS-Type 헤더와 마찬가지로 필수 요소입니다.

Apple 푸시 알림 서비스에 대한 기본 등록:

<?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>

참고

Tags 요소는 선택 사항입니다.

Apple 푸시 알림 서비스에 대한 템플릿 등록:

<?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>

참고

BodyTemplate 요소는 필수 요소입니다. 만료는 선택 사항입니다.

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>

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>

참고

Tags 요소는 선택 사항입니다.

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>

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>

참고

BodyTemplate 요소는 필수 요소입니다.

Microsoft 푸시 알림 서비스에 대한 기본 등록:

<?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>

참고

Tags 요소는 선택 사항입니다.

Microsoft 푸시 알림 서비스에 대한 템플릿 등록:

<?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>

참고

BodyTemplate 요소는 X-WindowsPhone-Target 헤더와 마찬가지로 필수 요소입니다.

응답

응답에는 HTTP 상태 코드 및 응답 헤더 집합이 포함되어 있습니다.

응답 코드

코드 Description
201 등록이 만들어졌습니다.
400 잘못된 요청 본문입니다. 요청의 형식이 잘못되어 등록을 만들 수 없습니다.
401 인증 실패 액세스 키가 잘못되었습니다.
403 할당량이 초과되었습니다. 이 네임스페이스에 등록이 너무 많습니다. 등록이 만들어지지 않았습니다.
403 등록 작업 속도가 너무 빨라 요청이 거부되었습니다.

상태 코드에 대한 자세한 내용은 상태 및 오류 코드를 참조하세요.

응답 헤더

응답 헤더 Description
Content-type application/atom+xml;type=entry;charset=utf-8
ETag {취약한 ETag}

응답 본문

요청이 성공하면 유효성이 검사된 Atom 항목이 반환됩니다. 여기에는 ETag, RegistrationId 및 ExpirationTime과 같은 읽기 전용 요소가 포함됩니다. 예:

<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>