TAGRU API Documents
last update 2017/01/31
Request
API URL
http://service.tagru.net/api/get_contents.api
Request Parameter
パラメタ | 設定値 | 必須 | 初期値 | 備考 |
---|---|---|---|---|
hash | キャンペーンのハッシュ値 | 必須 | 20 | ハッシュの取得方法は後述 |
limit | 取得件数 | – | 20 | |
page | 何件目から取得するか | – | 1 | page x limit で計算されます |
htmltext | 本文をHTMLとして取得するか | – | 0 | 1 の場合置換します。 置換をした場合、改行は<br>に、ユーザ名とハッシュタグはリンクに置換されます。 |
callback | コールバック関数名 | 必須 | 指定されない場合、セキュリティエラーにより取得したデータにアクセスすることが出来ません。 |
キャンペーンのハッシュ値の取得方法
キャンペーンのハッシュ値は、ログイン後の各キャンペーン設定ページのURLから確認する事ができます。
管理画面のURLにある、ランダムな数字とアルファベットで構成されたランダム文字列 ( campaign/xxxxxxxxxx/ の赤字部分) です。
Request Sample
https://service.tagru.net/api/getcampaign.api?hash=xxxxxxxxxxxxxxxx&page=1&limit=40&callback=jQuery30007091690098702448_1485832379644
JQuery の $.ajax にて取得した際の URL サンプルです
Response
Response Body
Key | Value | 備考 | |
---|---|---|---|
status | string | データの取得に成功したかどうか | OK | NG |
result | Object | 取得結果 | 仔細はResult Dataを参照 |
Result Data
Key | Value | 備考 | |
---|---|---|---|
total | number | 全何件のデータが存在するか | |
from | number | 何件目からの取得か | 1 から始まる |
from | number | 何件目まで取得したか | total に達した場合は total と同値 |
content_list | array | 取得したコンテンツ情報の配列 | 個々のコンテンツ情報の内容はContents Dataを参照 |
Contents Data
Key | Value | 備考 | |
---|---|---|---|
content_id | number | コンテンツ情報固有のID | TAGRU 内でのID |
service_type | string | どのサービスからの取得か | instagram | twitter |
post_id | string | 取得先サービスにおける投稿のID | |
post_user_id | string | 取得先サービスにおけるユーザのID | |
post_user_name | string | 取得先サービスにおけるユーザ名(英数字) | |
post_user_fullname | string | 取得先サービスにおけるユーザの設定名 | |
post_user_icon | string | 取得先サービスにおけるユーザのアイコン画像へのパス | ユーザがアイコンを変更した場合 404 となることがあります。 |
type | string | 投稿されたメディアの種類 | image | video |
url | string | 投稿へのパーマリンク | |
user_url | string | 投稿ユーザページへのパーマリンク | |
via | string | どこを経由しての投稿か | instagram | etc | null |
text | string | 投稿内容の文字列 |
Request Parameter の htmltext を 1 に指定した場合 改行は <br> タグに、 @[username] #[hashtag] は特定のクラス名がついた <a> のリンクへと置換されます。 |
image_small_url | string | 小さい画像のURL | |
image_small_width | number | 小さい画像の横サイズ | |
image_small_height | number | 小さい画像の縦サイズ | |
image_large_url | string | 大きい画像のURL | |
image_large_width | number | 大きい画像の横サイズ | |
image_large_height | number | 大きい画像の縦サイズ | |
video_url | string | 動画のURL | 画像の場合 null |
video_width | number | 動画の横サイズ | 画像の場合 null |
video_height | number | 動画の縦サイズ | 画像の場合 null |
video_low_resolution_url | string | 低解像度動画のURL | 画像の場合 null |
video_low_resolution_width | number | 低解像度動画の横サイズ | 画像の場合 null |
video_low_resolution_height | number | 低解像度動画の縦サイズ | 画像の場合 null |
image_filter | string | 投稿内容に設定されている特殊効果フィルタ名 | 未設定の場合 null |
location_id | string | 投稿に位置情報が含まれていた場合のその投稿場所のID | 存在しない場合 null 同一の地名でもサービスによって異なります |
location_name | string | 投稿場所の名称 | 存在しない場合 null |
location_latitude | number | 投稿場所の緯度 | 存在しない場合 null |
location_longitude | number | 投稿場所の経度 | 存在しない場合 null |
posted_at | string | 投稿日時 | YYYY-MM-DD H:i:s |
Response Sample
callback_function({ "status": "OK", "result": { "total": 100, "from": 1, "to": 20, "content_list": [ { "content_id": "123456", "service_type": "instagram", "post_id": "1234567890_123456", "post_user_id": "12345678", "post_user_name": "username", "post_user_fullname": "ユーザ名", "post_user_icon": "https:\/\/scontent.cdninstagram.com\/path\/to\/icon_image.jpg", "type": "image", "url": "https:\/\/www.instagram.com\/p\/XXXXXXX\/", "via": null, "text": "投稿のテキスト", "image_small_url": "path\/to\/small_image.jpg", "image_small_width": 320, "image_small_height": 320, "image_large_url": "path\/to\/large_image.jpg", "image_large_width": 640, "image_large_height": 640, "video_url": null, "video_width": null, "video_height": null, "video_low_resolution_url": null, "video_low_resolution_width": null, "video_low_resolution_height": null, "image_filter": "Normal", "location_id": "1234567", "location_name": "場所名", "location_latitude": 35.000000, "location_longitude": 139.000000, "posted_at": "2017-01-31 00:00:00", "user_url": "https:\/\/www.instagram.com\/path\/to\/user_page\/" }, : : ] } })