Sources

Updated

A source represents a source of data from a service. For example, an iCloud account is a source of the iCloud service.

Sources can have child sources, which expose only a specific part of the parent source. An example of this is an iCloud backup child source which, when targeted in a request for data, will only return data relating to that specific backup.

Attributes

name type description
id source ID Resource identifier.
resource string, always source Resource type specifier.
user user ID The user associated with this source.
type string Depends on the backing service. For example, iCloud has icloud_account source type.
identifier string A unique identifier for the source within the scope of its backing service.
parent optional, source ID Populated if the source is a child of another.
children optional, list of source resources Any sub-sources of the source.
state string One of: unvalidated, active, deactivated, blocked, locked.
date_created datetime When the resource was created.

Types

Currently supported types include: icloud.account, icloud.backup (child source only).

Identifier

The value of a source's identifier attribute identifies it uniquely within its service. For an iCloud account this would be the username.

Parent

If the source is a child source this field will point to its parent source object. The top source in this hierarchy is referred to as the primary source.

A child source cannot be created directly via the API, but are automatically created by the API when the appropriate poll is created. For example, once a Session is initialised for an icloud.account source, an info type Poll can be created which will retrieve information regarding the account, including any information on existing iCloud backups linked to the account, and create the corresponding child sources for these. The child sources can then be targeted directly for retrieving data via separate polls.

States

unvalidated
a session has never been successfully created against this source, therefore the API cannot tell if it is a valid source.
active
the source has been validated and is ready for use.
deactivated
access to the source has been forbidden by the owning organisation.
blocked
access to the source has been forbidden by an API admin.
locked
access to the source has been temporarily restricted by the external service.

Create POST /sources

Parameters

name type description
user required, user ID The user that the source will be associated with.
type required The kind of source being created. See the appropriate service source definition for detail on this.
identifier required The identifier for the source. For example, for the iCloud service this will be the iCloud account username.

Using cURL

curl https://ricloud-api.reincubate.com/sources \
  -X POST \
  -H 'Authorization: Token <your key_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "user": 1,
  "type": "icloud.account",
  "identifier": "john.appleseed@reincubate.com"
}'

Using ricloud-py

import ricloud

source = ricloud.Source.create(
  user=1,
  type='icloud.account',
  identifier='john.appleseed@reincubate.com'
)

Retrieve GET /sources/{source ID}

Using cURL

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

Using ricloud-py

import ricloud

source = ricloud.Source.create(<source ID>)

List GET /sources

name type description
organisation super, organisation ID For API admins to filter by organisation.
user user ID Filter by associated user.
type string Filter by source type.
identifier string Filter by source identifier.
state string Filter by source state.
date_created datetime filter Filter by resource creation date.

Using cURL

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

Using ricloud-py

import ricloud

sources = ricloud.Source.list()

Update POST /sources/{source ID}

name type description
state string Update the source state.

Using cURL

curl https://ricloud-api.reincubate.com/sources/<source ID> \
  -X POST \
  -H 'Authorization: Token <your key_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "state": "deactivated"
}'

Using ricloud-py

import ricloud

source = ricloud.Source.update_with_id(<source ID>, state='deactivated')

# OR

source = ricloud.Source.retrieve(<source ID>)

source.update(state='deactivated')

How can we help?

Our support team are here to help!

Our office hours are Monday to Friday, 9am to 5pm GMT.

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

Get in touch › 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.