Subscriptions

Updated

A subscription object represents a continuing request for data, such as "retrieve new CallKit calls every 24 hours" or "retrieve the latest iOS messages from a Reincubate Relay source when a new backup is made".

Different services can implement subscriptions in slightly different ways. The iCloud service works on a periodic polling mechanism, whereby it checks for new data every set interval of time. The rirelay service works on a push mechanism, publishing new data as soon as it becomes available.

Attributes

name type description
id string Resource identifier.
resource string, always subscription Resource type identifier.
org organisation ID The subscription's associated organisation.
source source ID
session session ID
poll_payload nested poll payload The payload of polls to be created by the subscription. See poll payload.
interval optional timedelta The interval between polls.
date_start optional datetime The date to start creating polls.
date_end optional datetime The date to stop creating polls.
state string One of: pending, active, deleted.
date_created datetime When the resource was created.

Create POST /subscriptions

name type description
session session ID Which session to create polls against.
source optional, source ID Optionally target a child source of the session-linked source.
poll_payload nested poll payload The poll payload used to specify poll
interval optional timedelta The interval between polls.
date_start optional datetime The date to start creating polls.
date_end optional datetime The date to stop creating polls.

Using cURL

curl https://ricloud-api.reincubate.com/subscriptions \
  -X POST \
  -H 'Authorization: Token <your key_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "session": "<session ID>",
  "source": "<source ID>",
  "poll_payload": {
    "data_types": ["ios_messages.messages", "whatsapp.messages"]
  }
}'

Using ricloud-py

import ricloud

poll_payload = {
  "data_types": ["ios_messages.messages", "whatsapp.messages"],
}

poll = ricloud.Poll.create(
  session="<session ID or ricloud.Session instance>",
  source="<source ID or ricloud.Source instance>",
  poll_payload=poll_payload,
)

Retrieve GET /subscriptions/{subscription ID}

Using cURL

curl https://ricloud-api.reincubate.com/subscriptions/<subscription ID> \
  -H 'Authorization: Token <your key_token>'

Using ricloud-py

import ricloud

poll = ricloud.Subscription.retrieve(<subscription ID>)

List GET /subscriptions

Using cURL

curl https://ricloud-api.reincubate.com/subscriptions \
  -H 'Authorization: Token <your key_token>'

Using ricloud-py

import ricloud

polls = ricloud.Subscription.list()

How can we help?

Our support team are here to help!

Our office hours are Monday to Friday, 9 AM to 5 PM GMT. The time is currently 12:17 AM GMT.

We aim to reply to all messages within one working day.

Go to support section › Contact the enterprise team ›
Our awesome support team

© 2008 - 2019 Reincubate Ltd. All rights reserved. Registered in England and Wales #5189175, VAT GB151788978. Reincubate® is a registered trademark. Privacy & terms. We recommend 2FA. Built with in London.