โš™๏ธDemo Using APIs and UI

1. Login as a User

1.1 Get the list of policies.

Displaying list of policies

GET /api/v1/policies/

{
    [
			{
				id: "621376c8e6763a0014fb0de4",
				config:{
					id: "97379c43-2bce-4e67-9817-a79fbad3e53d",
					blockType: "InterfaceContainerBlock"
				}
			}
		]
}

1.2 In the policy config there is a root block which is the top of the structure

1.3 Request the config for the root block

Requesting configuration of root block

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/97379c43-2bce-4e67-9817-a79fbad3e53d

{
    	uiMetaData: {...},
			blocks: [
				{
					id: "bb342b37-8bb6-4595-93fc-98fd63a23c16",
					blockType: "PolicyRolesBlock"
				}
			]
}

1.4 Root block contains other blocks in the 'blocks' field. Request the config for the block by the block ID. Recursively repeat this operation for all contained blocks in order to construct all components.

Requesting configuration of block by block ID

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/bb342b37-8bb6-4595-93fc-98fd63a23c16

{
     roles: 
                            ["INSTALLER"] 
                            uiMetaData: {...}, 
}

1.5 At present only PolicyRolesBlock is available to the user. Select the "INSTALLER" role.

Registering the role as

POST /api/v1/policies/621376c8e6763a0014fb0de4/blocks/bb342b37-8bb6-4595-93fc-98fd63a23c16

Request the role

Path Parameters

1.6 Request the root block and all contained blocks.

1.6.1 Requesting InterfaceStepBlock

Requesting InterfaceStepBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/97379c43-2bce-4e67-9817-a79fbad3e53d

{
    uiMetaData: {...},
    blocks: [
                {
			id: "9d98e2fd-6d2b-4152-b48c-cf10eb4f1298",
			blockType: "InterfaceStepBlock"
                }
            ]
}

1.6.2 Requesting requestVCDocumentBlock

Request requestVCDocumentBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/9d98e2fd-6d2b-4152-b48c-cf10eb4f1298

{
    uiMetaData: {...},
    blocks:[
		id: "53dac8a9-b480-457e-920a-e4d4c653bfbe",
		blockType: "requestVCDocumentBlock"
           ]
}

1.6.3 Requesting Installer Details

Requesting Installer Details

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/53dac8a9-b480-457e-920a-e4d4c653bfbe

{
    uiMetaData: {...},
    schema: {...}
}

1.7 Create json according to the schema and send to the requestVCDocumentBlock

Creating JSON and sending it to requestVCDocumentBlock

POST /api/v1/policies/621376c8e6763a0014fb0de4/blocks/53dac8a9-b480-457e-920a-e4d4c653bfbe

Request Body

1.8 Request the root block and all contained blocks again.

1.8.1 Requesting InterfaceStepBlock

Requesting InterfaceStepBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/97379c43-2bce-4e67-9817-a79fbad3e53d

{
    uiMetaData: {...},
    blocks: [
        {
	    id: "9d98e2fd-6d2b-4152-b48c-cf10eb4f1298",
	    blockType: "InterfaceStepBlock"
	}
	    ]
}

1.8.2 Requesting InformationBlock

Requesting InformationBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/9d98e2fd-6d2b-4152-b48c-cf10eb4f1298

{
    uiMetaData: {...},
    blocks:[
	        id: "2368a338-adaa-434a-a7a0-803e009e5717"
		blockType: "InformationBlock"
           ]
}

1.8.3 Requesting data after approval

Waiting for the data to be approval

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/2368a338-adaa-434a-a7a0-803e009e5717

{
    uiMetaData: {...},
}

2. Login as a Standard Registry

2.1 Request the list of policies.

Request List of policies

GET /api/v1/policies

{
    {
		id: "621376c8e6763a0014fb0de4",
		config:{
				id: "97379c43-2bce-4e67-9817-a79fbad3e53d",
				blockType: "InterfaceContainerBlock"
			}
    }
}

2.2 Request the root block and all contained blocks.

2.2.1 Requesting InterfaceContainerBlock

Requesting InterfaceContainerBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/97379c43-2bce-4e67-9817-a79fbad3e53d

{
    uiMetaData: {...},
    blocks: [
		{
                        id: "77da138a-c455-4ec6-8202-fd6a529f5300",
			blockType: "InterfaceContainerBlock"
		}
	    ]
}

2.2.2 Requesting InterfaceContainerBlock

Requesting InterfaceContainerBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/77da138a-c455-4ec6-8202-fd6a529f5300

{
    uiMetaData: {...},
    blocks:[
		id: "e5c40e14-3970-4f40-9e2c-34a260e6f499",
		blockType: "InterfaceContainerBlock"
           ]
}

2.2.3 Requesting InterfaceDocumentsSourceBlock

Requesting InterfaceDocumentsSourceBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/e5c40e14-3970-4f40-9e2c-34a260e6f499

{
    uiMetaData: {...},
    blocks:[
		id: "d5c7c788-696d-457d-985e-dce3886b7267",
		blockType: "InterfaceDocumentsSourceBlock"
           ]
}

2.2.4 Requesting Approval

Requesting Approval

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/d5c7c788-696d-457d-985e-dce3886b726

{
    uiMetaData: {...},
    data:[...],
    fields: [
		...
		{
		    action: "block"
                    bindBlock: "approve_documents_btn"
		}
            ]
}

Requesting BlockID

GET /api/v1/policies/621376c8e6763a0014fb0de4/tag/approve_documents_btn

{
    "id":"6f0f37c0-b62b-4be5-b1d0-e8114398350d"
}

Requesting InterfaceActioBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/6f0f37c0-b62b-4be5-b1d0-e8114398350d

{
    "id":"6f0f37c0-b62b-4be5-b1d0-e8114398350d",
    "blockType":"InterfaceActionBlock",
    "type":"selector",
    "uiMetaData":{
			"field":"status",
			"options":[
				    {
					"name":"Approve","value":"APPROVED","uiClass":"btn-approve","bindBlock":"update_approve_document_status"},
				    {
					"name":"Reject","value":"REJECTED","uiClass":"btn-reject","bindBlock":"rejected_approve_document_status"}
				  ]
		},
    "field":"option.status"
}

2.4 Approve the document

Select the VC from the grid:	
		const VC = data[0];
		
Change status:	
		VC.option.status = "APPROVED";
		
Send to the VC:
POST  /api/v1/policies/621376c8e6763a0014fb0de4/blocks/6f0f37c0-b62b-4be5-b1d0-e8114398350d
		Request:
				VC
				

3. Login as the User

3.1 Request the root block and all the contained blocks.

3.1.1 Requesting InterfaceStepBlock

Requesting InterfaceStepBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/97379c43-2bce-4e67-9817-a79fbad3e53d

{
    uiMetaData: {...},
    blocks: [
                {
			id: "9d98e2fd-6d2b-4152-b48c-cf10eb4f1298",
			blockType: "InterfaceStepBlock"
                }
            ]
}

3.1.2 Requesting InterfaceContainerBlock

Requesting InterfaceContainerBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/9d98e2fd-6d2b-4152-b48c-cf10eb4f1298

{
    uiMetaData: {...},
    blocks:[
    {
	id: "7b9273a1-1398-4560-be19-cc59d6c4c752",
	blockType: "InterfaceContainerBlock"
    }
	   ]
}

3.1.3 Requesting multiple InterfaceContainerBlock

Requesting multiple InterfaceContainerBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/7b9273a1-1398-4560-be19-cc59d6c4c752

{
    uiMetaData: {...},
    blocks:[
		{
			id: "4008376b-0047-4004-83df-cf4c3555fc33",
			blockType: "InterfaceContainerBlock"
		},
		{
			id: "7b47566d-c61e-4a74-8646-3d9bbac8eb42",
			blockType: "InterfaceContainerBlock"
		}
	    ]
}

3.1.4 Requesting InterfaceDocumentsSourceBlock and InterfaceStepBlock

Requesting InterfaceDocumentsSourceBlock and InterfaceStepBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/4008376b-0047-4004-83df-cf4c3555fc33

{
    uiMetaData: {...},
    blocks:[
		{
			id: "af9fd59b-06a3-48b5-b610-b0af7888e39b",
			blockType: "InterfaceDocumentsSourceBlock"
		}
		{
			id: "06cfd440-03ec-471e-9b3f-e0c583555b94",
			blockType: "InterfaceStepBlockBlock"
		}
	   ]
}

3.1.5 Requesting Data

Requesting Data

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/af9fd59b-06a3-48b5-b610-b0af7888e39b

{
    uiMetaData: {...},
    data:[...],
    fields: [...]
}

3.1.6 Requesting requestVCDocumentBlock

Requesting requestVCDocumentBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/06cfd440-03ec-471e-9b3f-e0c583555b94

{
    uiMetaData: {...},
    blocks:[
                {
			id: "d068b59e-eec7-4452-b866-468e9ed6c7fa"
			blockType: "requestVCDocumentBlock"
                }
           ]
}

3.1.7 Requesting Data and Schema

Requesting Data and Schema

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/d068b59e-eec7-4452-b866-468e9ed6c7fa

{
    uiMetaData: {...},
    schema: {...}
}

Requesting BlockID

GET /api/v1/policies/621376c8e6763a0014fb0de4/tag/download_config_btn

{
    "id":"24942cf7-fcc5-4dff-8471-d5affeb4c206"
}

3.2.1 Requesting InterfaceActionBlock

Requesting InterfaceActionBlock

GET /api/v1/policies/621376c8e6763a0014fb0de4/blocks/24942cf7-fcc5-4dff-8471-d5affeb4c206

{
    id: "24942cf7-fcc5-4dff-8471-d5affeb4c206",
    blockType: "InterfaceActionBlock",
    type: "download",
    "uiMetaData":{...}
}

3.3 Create a sensor

Creating a Sensor

POST /api/v1/policies/621376c8e6763a0014fb0de4/blocks/d068b59e-eec7-4452-b866-468e9ed6c7fa

Request Body

3.4 Refresh the Blocks

3.5 Download the config

Downloading the configuration

POST /api/v1/policies/621376c8e6763a0014fb0de4/blocks/24942cf7-fcc5-4dff-8471-d5affeb4c206

Request Body

3.6 Sample MRV Sender Data

Sending MRV Data

POST /external

Sending MRV Data

Request Body

{
    // Response
}

Last updated