世論調査

ポーリングリソースには、データに対する特定の要求に関する情報が含まれています。ポーリングが作成されると、リクエストを完了するために1つ以上のタスクの作成がトリガーされます。
属性
名前 | タイプ | 説明 |
---|---|---|
id |
poll ID | Resource identifier. |
resource |
string, always poll |
Resource type specifier. |
organisation |
organisation ID | The organisation associated with this resource. |
key |
key ID | The key associated with this resource. |
user |
user ID | The user associated with this resource. |
source |
source ID | The source the poll is targeting. This can be a child source of the session's source. |
session |
session ID | The session the poll is using. |
subscription |
optional subscription ID | The associated subscription object ID, if applicable. |
tasks_pending |
list of task IDs | The tasks associated with the poll that are awaiting processing. |
tasks_processing |
list of task IDs | The tasks associated with the poll that are being processed. |
tasks_succeeded |
list of task IDs | The tasks associated with the poll that have succeeded. |
tasks_failed |
list of task IDs | The tasks associated with the poll that have failed. |
tasks_suspended |
list of task IDs | The tasks associated with the poll that are suspended. |
results |
list object containing result objects | List of result objects generated by the poll's tasks. |
errors |
list object containing error objects | List of error objects generated by the poll's tasks. |
state |
string | One of: pending , processing , completed . |
date_created |
datetime | When the resource was created. |
date_started |
optional datetime | When processing of the poll began. |
date_completed |
optional datetime | When processing of the poll finished. |
タスク
ポーリングリソースの最も重要な役割は、関連するタスクの進行状況を反映し、エンドユーザーが結果が利用可能になり次第、結果を取得できるようにすることです。したがって、ポーリングリソースは、タスクに関連する属性を公開します。関連するタスクは、その状態によって分類されます。
結果
投票内で実行されているタスクによって発行された結果は、投票のresults
属性に表示されます。これにより、投票が完了する前に結果を利用できます。
エラー
投票内で実行されているタスクによって発生したエラーは、投票のerrors
属性に表示されます。
州
ポーリングの状態は、ポーリングが初期化を待っている( pending
)、進行中( processing
)、またはすべてのタスクが実行を終了した( completed
)のいずれかを反映するだけです。
投票は、それに関連したタスク以外のエラー状態を反映しません。
ペイロード
ポーリングペイロードは、取得する必要がある情報の種類、データ型、およびファイルを示します。ポーリングペイロード属性スキーマについては、以下で説明します。
名前 | タイプ | 説明 |
---|---|---|
info_types |
list of info_type objects |
Specifies which info types should be retrieved. Supports wildcard * . |
data_types |
list of data_type objects |
Specifies which data types should be retrieved. |
files |
list of file IDs. |
Specifies which files to retrieve. |
filters |
nested filters object |
Specifies which filters to apply to retrieved data. |
たとえば、iCloudアカウントソースのすべてのタイプの情報を取得するためのポーリングペイロードは次のようになります。
{ "info_types": ["*"] }
特定の日付からのみ、iCloudバックアップまたはReincubate Relayソースからさまざまなメッセージングデータを取得するには:
{ "data_types": ["ios_messages.messages", "whatsapp.messages", "viber.messages"], "filters": { "since": "2019-09-15T22:04:12Z", "until": "2021-06-02T12:00:00Z" } }
iCloudフォトライブラリの結果で参照される画像のファイルデータを取得するには:
{ "files": ["icpl://xyz123", "icpl://abc321"] }
異なる属性を同時に使用することもできます。
{ "info_types": ["*"], "data_types": ["ios_phone.calls"] }
Filters
Filters allow the client to reduce the amount of data returned to only that which is likely to be of interest. For example, you might filter a poll for SMS data to only the last month of data.
name | type | description |
---|---|---|
since |
optional datetime | Filter to only data that was created after this datetime. |
until |
optional datetime | Filter to only data that was created before this datetime. |
Filters in subscription poll payloads
When using subscriptions to generate regular polls, any filters set in the poll payload will only be used on the initial poll of the subscription. Thereafter, the API will do the following:
- Any value for
until
is ignored as to avoid simply re-polling the same interval repeatedly - If
until
was set, the next poll will fetch data from that point in time forward - If
until
was not set, the next poll will fetch data from the time of the initial poll forward (i.e. the API will poll progressively as normal)
POST /polls
作成する
特定のセッションに対するデータのポーリングを作成します。
source
パラメータは、セッションのプライマリソースの子ソースを対象とする場合にのみ使用してください。たとえば、 rirelay.source
からデータを取得する場合、 source
パラメータはそのソースのIDである必要があります。
名前 | タイプ | 説明 |
---|---|---|
key |
optional, key ID | Optionally override the key used for this poll. This is useful when letting users trial new functionality. |
source |
optional, source ID | Optionally target a child source of the session-linked source. |
session |
session ID | The session to be used to authenticate data retrieval. |
subscription |
subscription ID | The subscription to use to perform the poll. If this is provided, source and session can be omitted. |
payload |
nested poll payload | The poll payload used to specify poll |
cURLを使う
curl https://ricloud-api.reincubate.com/polls \ -X POST \ -H 'Authorization: Token <your key_token>' \ -H 'Content-Type: application/json' \ -d '{ "session": "<session ID>", "payload": { "info_types": ["*"] } }'
ricloud-pyを使う
import ricloud poll_payload = { 'info_types': ['*'], } poll = ricloud.Poll.create( session='<session ID or ricloud.Session instance>', payload=poll_payload, )
サンプル応答
{ "id": "54554389-5f1a-4ccf-9bb8-024a031cf948", "resource": "poll", "organisation": 1, "key": 1, "user": 1, "source": 1, "session": "f5a7a7ef-ff21-47fe-9aa6-7ebd08123623", "subscription": null, "tasks_pending": [], "tasks_processing": [], "tasks_succeeded": [], "tasks_failed": [], "tasks_suspended": [], "results": { "data": [], "has_more": false, "total_count": 0, "url": "/polls/54554389-5f1a-4ccf-9bb8-024a031cf948/results" }, "errors": { "data": [], "has_more": false, "total_count": 0, "url": "/polls/54554389-5f1a-4ccf-9bb8-024a031cf948/errors" }, "state": "pending", "date_created": "2020-02-20T11:59:14.694337Z", "date_started": null, "date_completed": null }
GET /polls/{poll ID}
取得してください
cURLを使う
curl https://ricloud-api.reincubate.com/polls/<poll ID> \ -H 'Authorization: Token <your key_token>'
ricloud-pyを使う
import ricloud poll = ricloud.Poll.retrieve(<poll ID>)
GET /polls
リスト
名前 | タイプ | 説明 |
---|---|---|
key |
key ID | Filter by associated key. This is the key used by the user at the time. |
user |
user ID | Filter by associated user. |
source |
source ID | Filter by the target source. |
session |
session ID | Filter by the target session. |
subscription |
subscription ID | Filter by the associated subscription. |
state |
string | Filter by session state. |
date_created |
datetime filter | Filter by when the resource was created. |
date_started |
datetime filter | Filter by when the poll started. |
date_completed |
datetime filter | Filter by when the poll was finished. |
cURLを使う
curl https://ricloud-api.reincubate.com/polls \ -H 'Authorization: Token <your key_token>'
ricloud-pyを使う
import ricloud polls = ricloud.Poll.list()
変更ログ
2022-07-08
- Support for the
until
filter in poll payloads was added for SMS extraction. This complements thesince
filter to allow clients to specify an exact datetime range to retrieve data from.
2020-05-05
-
errors
属性が投票オブジェクトに追加されました。これは、投票に関連付けられたエラーオブジェクトを含むネストされたリストオブジェクトです。
2020-02-20
- Major :pollオブジェクトの
results
属性は、単純なリスト属性ではなく、ネストされたリストオブジェクトになりました。これにより、投票が多数の結果を公開するときに、結果にページ番号を付けることができます。
2019-10-16
-
subscription
によってポーリングがトリガーされたかどうかを示すために、subscription
属性をポーリングオブジェクトに追加します。
2019-06-01
- ポーリングオブジェクトの
payload
属性は、複数の操作タイプで構成できるようになりました。これは、ペイロードのinfo-types
、data-types
、およびfiles
またはすべてを使用してポーリングを作成できることを意味しfiles
。 - Major構成可能なポーリングペイロードのために、pollオブジェクトの
type
属性は非推奨になりました。