Understanding Instant JSON attachments and schemas

Types

This section explains how to use type declarations in Instant JSON records.

The optional keys are specified as follows:

{ optionalKey?: value; }

To save traffic, these keys shouldn’t be included in the record if the value is undefined.

Attachments

Attachments were added to support syncing annotation attachments across different devices. The keys in attachments are the calculated SHA-256 hashes of the attachment or the pdfObjectId of the attachment. The binary of the attachment is Base64 encoded:

// Example of the Instant JSON schema of an attachments payload with one attachment:
{
	"attachments": {
		"9e51e601bb7469be642f0b0d60bbb98aeb631353839ab3bc5a25797dbb74622f": {
			"binary": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYlWNgAAIAAAUAAdafFs0AAAAASUVORK5CYII=",
			"contentType": "image/png"
    	}
	}
}
declare type Attachments = {
  [string]: {
    binary: string
  }
};

For more information on the annotations Instant JSON schema, please refer to the JSON format schema — annotations guide.