Create#

Usage: client.platform.documents.create(typeLocator, identity, documentOpts)
Description: This method will return a ExtendedDocument object initialized with the parameters defined and apply to the used identity.

Parameters:

Parameters

Type

Required

Description

dotLocator

string

yes

Field of a specific application, under the form appName.fieldName

identity

Identity

yes

A valid registered identity

docOpts

Object

yes

A valid data that match the data contract structure

Example:

const identityId = '';// Your identity identifier
const identity = await client.platform.identities.get(identityId);

const helloWorldDocument = await client.platform.documents.create(
      // Assume a contract helloWorldContract is registered with a field note
      'helloWorldContract.note',
      identity,
     { message: 'Hello World'},
  );

Note: When your document is created, it will only exist locally, use the broadcast method to register it.

Returns: ExtendedDocument