ステップ 3: データを取得する
Radian6 API による認証が終わり、トピックのリストを取得したら、トピックのデータを取得できます。
次の例は、Radian6 システムからあるトピックについて過去 24 時間のうち最近の 100 項目を取得する方法を示します。このデータの取得に使用するコールは、DataService.fetchRecentTopicPosts です。
1https://api-endpoint/data/topicdata/recent/{recentXhours}/{topics}
2
3/{mediatypes}/{PageIndex}/{pageSize}- recentXHours
- 24 (過去 24 時間のデータ)
- topics
- 232 (「ステップ 2: メソッドへのコールを発行する」のコールで取得したトピック ID)
- mediatypes
- 1,2,3,4 (LookupService.fetchMediaTypes で取得)
- PageIndex
- 1 (最初のページ)
- pageSize
- 100 (現在のページの全項目)
たとえば、開発エンドポイントへのコールは次のようになります。
1https://sandbox-insights.radian6.com/socialcloud/v1/data/topicdata
2
3/realtime/24/232/1,2,3,4/1/100このコールは、一致する投稿のリストをデフォルトの並び順である publish_date で並び替えて返します。結果セットの各項目は、<Article> タグで定義されます。
1<radian6_RiverOfNews_export>
2
3 <report_date>Fri Oct 30 10:22:06 ADT 2009</report_date>
4
5 <user_name>Jane Smith</user_name>
6
7 <RoN_sort_order>publishedDate</RoN_sort_order>
8
9 <article_count>1</article_count>
10
11 <article ID="1934621185">
12
13 <description charset="UTF-8">
14
15 <headline><![CDATA[ TWEET FROM: ACME]]>
16
17 </headline>
18
19 <author><![CDATA[ ACME]]>
20
21 </author>
22
23 <content><![CDATA[ The content of the Tweet]]>
24
25 </content>
26
27 </description>
28
29 <source><![CDATA[ TWEET FROM: ACME]]></source>
30
31 <host><![CDATA[ twitter.com]]></host>
32
33 <article_url> <![CDATA[ http://twitter.com/username/statuses/4735539663]]>
34
35 </article_url>
36
37 <media_provider>TWITTER</media_provider>
38
39 <media_type_id>8</media_type_id>
40
41 <spam_rating>TODO</spam_rating>
42
43 <publish_date>Oct 09, 2009 11:31 AM</publish_date>
44
45 <harvest_date>Oct 09, 2009 11:31 AM</harvest_date>
46
47 <PostDynamicsIteration>
48
49 <PostDynamicsDefinition>
50
51 <fieldId>9</fieldId>
52
53 <label>Following</label>
54
55 <value>0</value>
56
57 <sortOrder>1</sortOrder>
58
59 </PostDynamicsDefinition>
60
61 <PostDynamicsDefinition>
62
63 <fieldId>8</fieldId>
64
65 <label>Followers</label>
66
67 <value>0</value>
68
69 <sortOrder>2</sortOrder>
70
71 </PostDynamicsDefinition>
72
73 <PostDynamicsDefinition>
74
75 <fieldId>10</fieldId>
76
77 <label>Updates</label>
78
79 <value>0</value>
80
81 <sortOrder>3</sortOrder>
82
83 </PostDynamicsDefinition>
84
85 <PostDynamicsDefinition>
86
87 <fieldId>21</fieldId>
88
89 <label>Sentiment</label>
90
91 <shortLabel>S</shortLabel>
92
93 <sortOrder>4</sortOrder>
94
95 <value>15418,0</value>
96
97 <exceptionValue>15418,false</exceptionValue>
98
99 <reportValue>Neutral</reportValue>
100
101 <tooltip />
102
103 </PostDynamicsDefinition>
104
105 <reportFormatedData><![CDATA[ <span style="font-weight:bold; color: #FF9900; font-size: 11pt"> Following: </span>0 <span style="font-weight:bold; color: #FF9900; font-size: 11pt"> Followers:
106
107 </span>0 <span style="font-weight:bold; color: #FF9900; font-size: 11pt"> Updates: </span>0 <span style="font-weight:bold; color: #FF9900; font-size: 11pt"> Sentiment: </span>Neutral ]]>
108
109 </reportFormatedData>
110
111 </PostDynamicsIteration>
112
113 </article>
114
115 </radian6_RiverOfNews_export>