12.5. サブスクライバー

12.5.1. 一般情報

モジュール名 subscriber
APIバージョン 1

以下の値は、Base64エンコードしてリクエストする必要があります。 また、レスポンスはBase64エンコードされたものになります。

  • コンテンツに含むバイナリ

12.5.2. 標準API

12.5.2.1. トピックへのコンテンツの投稿

トピックへコンテンツを投稿します。

PUT /nex/subscriber/v1/contents
POST /nex/subscriber/v1/contents/put

リクエストボディ:

要素名 親要素 内容
post_content_param   ルート要素。 必須
pid post_content_param 投稿者のプリンシパル ID。省略した場合は公式ユーザーのプリンシパル ID (111) が使用されます。
topics post_content_param 投稿先トピックのコンテナ。 必須
topic topics 投稿先トピック。複数のtopicタグを指定できます。一つ以上のtopicタグが必要です。 必須
name topic 投稿先トピック文字列。 必須
message post_content_param 投稿する任意のメッセージ。省略した場合は空文字列になります。
binary post_content_param 投稿する任意のバイナリ。URL SafeなBase64エンコードをして指定。省略した場合は空になります。

リクエスト例:

プリンシパル ID 1000 のユーザーがトピック「r_1」に文字列「hello」とバイナリ「\x41\x42\x43\x44」を投稿する例。

PUT /nex/subscriber/v1/contents HTTP/1.1

<post_content_param>
  <pid>1000</pid>
  <topics>
    <topic>
      <name>r_1</name>
    </topic>
  </topics>
  <message>hello</message>
  <binary>QUJDRA==</binary>
</post_content_param>

レスポンス例:

HTTP/1.1 200 OK
Content-Type:  text/xml;charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<nex>
  <subscriber>
    <content_id>2</content_id>
  </subscriber>
</nex>

content_idは投稿したコンテンツに振られたコンテンツ ID。

12.5.2.2. コンテンツの取得

トピックからコンテンツを取得します。

GET /nex/subscriber/v1/topics/(topic_name)/contents
名前 内容
topic_name コンテンツを取得したいトピック文字列。 必須
size 取得するコンテンツの最大数。省略すると 20 が指定されます。
offset 取得するコンテンツのオフセット。省略すると 0 が指定されます。

リクエスト例:

トピック「r_1」のコンテンツを取得する。

GET /nex/subscriber/v1/topics/r_1/contents?size=10 HTTP/1.1

レスポンス例:

HTTP/1.1 200 OK
Content-Type:  text/xml;charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<nex>
  <subscriber>
    <contents length="1">
      <content>
        <content_id>2</content_id>
        <message>hello</message>
        <binary>QUJDRA==</binary>
        <pid>1000</pid>
        <topics length="1">
          <topic>
            <name>r_1</name>
          </topic>
        </topics>
        <post_time>2015-01-01T00:00:00Z</post_time>
      </content>
    </contents>
  </subscriber>
</nex>

12.5.2.3. コンテンツが投稿されたトピック一覧の取得

一つ以上コンテンツが投稿されているトピックの一覧を取得します。

GET /nex/subscriber/v1/topics

リクエスト例:

トピック一覧を取得する。

GET /nex/subscriber/v1/topics HTTP/1.1

レスポンス例:

HTTP/1.1 200 OK
Content-Type:  text/xml;charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<nex>
  <subscriber>
    <topics length="10">
      <topic>
        <name>r_0</name>
      </topic>
      <topic>
        <name>r_1</name>
      </topic>
      <topic>
        <name>r_2</name>
      </topic>
      <topic>
        <name>r_3</name>
      </topic>
      <topic>
        <name>r_4</name>
      </topic>
      <topic>
        <name>r_5</name>
      </topic>
      <topic>
        <name>r_6</name>
      </topic>
      <topic>
        <name>r_7</name>
      </topic>
      <topic>
        <name>r_8</name>
      </topic>
      <topic>
        <name>r_9</name>
      </topic>
    </topics>
  </subscriber>
</nex>

12.5.2.4. コンテンツの削除

トピックに投稿されているコンテンツを削除します。 投稿時に複数のトピックを指定した場合、全てのトピックからコンテンツを削除するにはその全てのトピックを指定する必要があります。 投稿したトピックの内、一部のトピックを指定しなかった場合はそのトピックのコンテンツは削除されません。

POST /nex/subscriber/v1/contents/(content_id)/delete
名前 内容
content_id 削除するコンテンツ ID。 必須

リクエストボディ:

要素名 親要素 内容
delete_content_param   ルート要素。 必須
topics delete_content_param 削除元トピックのコンテナ。 必須
topic topics 削除元トピック。複数のtopicタグを指定できます。一つ以上のtopicタグが必要です。 必須
name topic 削除元トピック文字列。 必須

リクエスト例:

トピック「r_1」からコンテンツ ID 2 のデータを削除する。

POST /nex/subscriber/v1/contents/(content_id)/delete HTTP/1.1

<delete_content_param>
  <topics>
    <topic>
      <name>r_1</name>
    </topic>
  </topics>
</delete_content_param>

レスポンス例:

HTTP/1.1 200 OK

12.5.2.5. 指定したトピックに投稿されている全てのコンテンツを削除

指定したトピックに投稿されているコンテンツを全て削除します。

DELETE /nex/subscriber/v1/topics/(topic_name)/contents
POST /nex/subscriber/v1/topics/(topic_name)/contents/delete
名前 内容
topic_name 削除元トピック文字列。 必須

リクエスト例:

トピック「r_1」から全てのコンテンツを削除する。

DELETE /nex/subscriber/v1/topics/r_1/contents HTTP/1.1

レスポンス例:

HTTP/1.1 200 OK

12.5.2.6. 全てのトピックから全てのコンテンツを削除

投稿されているコンテンツを全て削除します。 全てのトピックのコンテンツが空になります。

DELETE /nex/subscriber/v1/topics/contents
POST /nex/subscriber/v1/topics/contents/delete

リクエスト例:

全てのコンテンツを削除する。

DELETE /nex/subscriber/v1/topics/contents HTTP/1.1

レスポンス例:

HTTP/1.1 200 OK