Data sources is one of the core business concept the Collaborate project relies on. A Data
source is an external partner application that contains asset relative data. When a datasource owner
wants to create NFT assets associated to a datasource, he needs firstly to generate a http router
configuration file (aka A datasource configuration, or
a Traefik configuration) by providing a DatasourceDTO
as a body
of POST /api/v1/datasource
.
The datasource configuration is stored in IPFS (a distributed file system), so it could be used later by other partners to access to the NFT asset data hold by the datasource.
Scope is another core business concept the datasources relies on. Scopes are used to make able a datasource to limit the resources a user can access.
During the creation, the owner provides credentials and other information required about the
authentication process used to access the datasource. In the bellow
samples OAuth 2.0 Client Credentials Grant is
defined by type
and grantType
fields. The authorizationServerUrl
field is used for getting a
valid token whe needed using credentials defined by clientId
and clientSecret
fields. Authentication information is cyphered and stored in your dApp instance ,
it will be used to generate access token when another partner would like to request access to this
datasource1. The partnerTransferMethod
field define the strategy to use in a such process
Currently OAuth 2.0 Client Credentials Grant is the only implemented authentication mechanisms. Basic Auth and Certificate Based Basic Auth are also available for experimentation purpose. More authentications mechanisms should be available in future versions
The resources
field is used for describing the mapping between an entry-point and the kind data it
exposes for an asset.
A resource Battery level is defined in the bellow dsp-b sample. It explains that a call to the
datasource /battery/$1
entry-point (where $1
defines a path parameter as a placeholder for an
asset id) while results in metric:battery
information for the asset identified by $1
path
parameter value.
When defining a datasource, there is an expected mandatory resource having keyworlds
field
containing list-asset
to be defined. This resource is used to test if Collaborate API succeeds in
communicating with the datasource. In the bellow dsp-b sample, it expects a GET /vehicle
to
results with an HTTP 200 OK status code.
The metadata:value.jsonPath:
keyword prefix value is an experimental feature for defining a
mapping to be applied on the response data.
To illustrate datasource usage, XDev provide a simple API that you can use for testing your first datasource creations.
Find here the Behavior Driven Development feature