The following are the general steps a typical client would complete after installing DCC to access the REST API using curl. Samples and examples in this section provide working illustrations of these concepts.

Setup a new collector:
  1. Create block:
    Request : curl --user admin:changeme --cacert /opt/DCF/Tools/Controller/Default/cert.pem -X POST -H 'Content-Type: application/json' https://127.0.0.1:8443/dcc/v1/catalog/blocks/smarts-metrics/provision
    
    	Response :
    		{
    		  "blockID": "smarts-metrics",
    		  "message": "Block successfully deployed",
    		  "time": "2019-02-25 23:25:06.824015",
    		  "instanceId": "smarts-metricseaea8c69-b12a-4fa6-8389-6ea87dd997c5",
    		  "params": {
    			"smarts-metrics": {
    			  "primary": {
    				"collect": {
    				  "sm": [
    					{
    					  "host": "localhost",
    					  "port": "12345",
    					  "name": "INCHARGE-AM-PM",
    					  "username": "admin",
    					  "password": "{FAF745B9C01D858B45D7F644CE55D30064E409A847AA2351B30B6FB74B3BA7FDEC5A9315ECA00C2F69D9C425039CA1F1}",
    					  "type": "both",
    					  "topologyPollingPeriod": "3600",
    					  "metricPollingPeriod": "240",
    					  "backendgroup": "group",
    					  "thread": {
    						"poolsize": "3"
    					  },
    					  "dmconnection": {
    						"poolsize": "3"
    					  }
    					}
    				  ]
    				}
    			  },
    			  "kafka": {
    				"cluster": {
    				  "node": [
    					{
    					  "host": "localhost",
    					  "port": "9092"
    					}
    				  ],
    				  "topic": "default-topic",
    				  "auth": "true",
    				  "username": "admin",
    				  "password": "admin-secret"
    				}
    			  }
    			}
    		  }
    		}
  2. Configure block:
    Request : curl --cacert /opt/DCF/Tools/Controller/Default/cert.pem --user admin:changeme --request POST --url https://127.0.0.1:8443/dcc/v1/runtime/blocks/smarts-metrics70d9afac-516a-47f5-b38f-799fa530d55c/config/set --header 'content-type: application/json' --data '{
    	  "smarts-metrics": {
    		"primary": {
    		  "collect": {
    			"sm": [
    			  {
    				"host": "localhost",
    				"port": "12345",
    				"name": "INCHARGE-AM-PM",
    				"username": "admin",
    				"password": "{544756F82CDB79957BC6004EA85A6F97CA541AE9AB6CDF4F8D1A99BD2D341B6AF8A75F35A5DE5C59651AFF574DBC604E}",
    				"type": "both",
    				"topologyPollingPeriod": "3600",
    				"metricPollingPeriod": "240",
    				"backendgroup": "group",
    				"thread": {
    				  "poolsize": "3"
    				},
    				"dmconnection": {
    				  "poolsize": "3"
    				}
    			  }
    			]
    		  }
    		},
    		"kafka": {
    		  "cluster": {
    			"node": [
    			  {
    				"host": "localhost11",
    				"port": "9092"
    			  }
    			],
    			"topic": "default-topic",
    			"authType": "SASL_PLAINTEXT",
    			"username": "admin",
    			"password": "{28811D69F2FEEA51A491E8DF763912A5B692517875494C8B524D712CF3576658B1E0ED1CF87F00B0F88E4EFAA487A5D6}"
    		  }
    		}
    	  }
    	}'
    	
    	Response : New configuration successfully set in block: smarts-metricseaea8c69-b12a-4fa6-8389-6ea87dd997c5  for smarts-metrics service
    
  3. Start block:
    Request : curl --cacert /opt/DCF/Tools/Controller/Default/cert.pem --user admin:changeme --request POST --url https://127.0.0.1:8443/dcc/v1/runtime/blocks/smarts-metrics70d9afac-516a-47f5-b38f-799fa530d55c/service/start
    
    	Response : [{"id": "apg-collector-manager-smarts-metricseaea8c69-b12a-4fa6-8389-6ea87dd997c5", "module": "collector-manager", "instance": "smarts-metricseaea8c69-b12a-4fa6-8389-6ea87dd997c5", "status": "STARTED", "last-modified": "1551155145000", "startup-mode": "auto", "start-order": "96", "stop-order": "4"}]
  4. Stop block:
    Request : curl --cacert /opt/DCF/Tools/Controller/Default/cert.pem --user admin:changeme --request POST --url https://127.0.0.1:8443/dcc/v1/runtime/blocks/smarts-metrics70d9afac-516a-47f5-b38f-799fa530d55c/service/stop
    
        Response : [{"id": "apg-collector-manager-smarts-metricseaea8c69-b12a-4fa6-8389-6ea87dd997c5", "module": "collector-manager", "instance": "smarts-metricseaea8c69-b12a-4fa6-8389-6ea87dd997c5", "status": "STOPPED", "last-modified": "1551155147000", "startup-mode": "auto", "start-order": "96", "stop-order": "4"}]
  5. Restart Service:
    Request : curl --cacert /opt/DCF/Tools/Controller/Default/cert.pem --user admin:changeme --request POST --url https://127.0.0.1:8443/dcc/v1/runtime/blocks/smarts-metrics70d9afac-516a-47f5-b38f-799fa530d55c/service/restart
    
    	Response : [{"id": "apg-collector-manager-cloudify-orchestratorffa3bb75-99f4-4613-8a5a-45e2cee0372c", "module": "collector-manager", "instance": "cloudify-orchestratorffa3bb75-99f4-4613-8a5a-45e2cee0372c", "status": "STARTED", "last-modified": "1551155175000", "startup-mode": "auto", "start-order": "96", "stop-order": "4"}]
  6. Get block object:
    Request : curl --cacert /opt/DCF/Tools/Controller/Default/cert.pem -u admin:changeme --request GET   --url https://127.0.0.1:8443/dcc/v1/catalog/blocks/smarts-metricsAPI/availability
    
    	Response : "smarts-metrics"
  7. Get instantiated block details:
    Request : curl --cacert /opt/DCF/Tools/Controller/Default/cert.pem -u admin:changeme --request GET   --url https://127.0.0.1:8443/dcc/v1/catalog/blocks/instances
    
    	Response : {"smarts-metrics4cc747e0-da89-433e-9233-a6895b89755b": {"block_object_id": "smarts-metrics", "deployment_status": "Running", "dc_service_status": "STOPPED", "poll_count": 16}, "smarts-metrics035f8121-aaed-4d66-83eb-ae3a7841f720": {"block_object_id": "smarts-metrics", "deployment_status": "Running", "dc_service_status": "STOPPED", "poll_count": 16}}
  8. Get block config:
    Request : curl --cacert /opt/DCF/Tools/Controller/Default/cert.pem --user admin:changeme --request GET --url https://127.0.0.1:8443/dcc/v1/runtime/blocks/smarts-metrics70d9afac-516a-47f5-b38f-799fa530d55c/config/get
    
    	Response :
    		{
    		  "smarts-metrics": {
    			"primary": {
    			  "collect": {
    				"sm": [
    				  {
    					"host": "localhost",
    					"port": "12345",
    					"name": "INCHARGE-AM-PM",
    					"username": "admin",
    					"password": "{FAF745B9C01D858B45D7F644CE55D30064E409A847AA2351B30B6FB74B3BA7FDEC5A9315ECA00C2F69D9C425039CA1F1}",
    					"type": "both",
    					"topologyPollingPeriod": "3600",
    					"metricPollingPeriod": "240",
    					"backendgroup": "group",
    					"thread": {
    					  "poolsize": "3"
    					},
    					"dmconnection": {
    					  "poolsize": "3"
    					}
    				  }
    				]
    			  }
    			},
    			"kafka": {
    			  "cluster": {
    				"node": [
    				  {
    					"host": "localhost",
    					"port": "9092"
    				  }
    				],
    				"topic": "default-topic",
    				"auth": "true",
    				"username": "admin",
    				"password": "admin-secret"
    			  }
    			}
    		  }
    		}
  9. Get Packages:
    Request : curl --cacert /opt/DCF/Tools/Controller/Default/cert.pem --user admin:changeme --request GET --url https://127.0.0.1:8443/dcc/v1/catalog/blocks/packages
    
    	Response : ["clearwater", "cloudify-orchestrator", "smarts-metrics", "smarts-notifs", "velocloud-sdwan", "vrops"]
    
  10. Get Services
    Request : curl --cacert /opt/DCF/Tools/Controller/Default/cert.pem --user admin:changeme --request GET --url https://127.0.0.1:8443/dcc/v1/catalog/blocks/smarts-metrics70d9afac-516a-47f5-b38f-799fa530d55c/services
    
    	Response : {"id": "apg-collector-manager-smarts-metricseaea8c69-b12a-4fa6-8389-6ea87dd997c5", "module": "collector-manager", "instance": "smarts-metricseaea8c69-b12a-4fa6-8389-6ea87dd997c5", "status": "STOPPED", "last-modified": "-1", "startup-mode": "auto", "start-order": "96", "stop-order": "4"}
    
  11. Get Default Block Config:
    Request : curl --cacert /opt/DCF/Tools/Controller/Default/cert.pem -u admin:changeme --request GET   --url https://127.0.0.1:8443/dcc/v1/catalog/blocks/smarts-metrics/config/default
    
    	Response :
    		{
    		  "smarts-metrics": {
    			"primary": {
    			  "collect": {
    				"sm": [
    				  {
    					"host": "localhost",
    					"port": "12345",
    					"name": "INCHARGE-AM-PM",
    					"username": "admin",
    					"password": "{CCC8B6EFC8D913616264F4B8A0D25B5A52DBFAFE4F6EB5BB94B86D4B25BC2FA7F11E59A9A733BBA10002A20C5D60EE6A}",
    					"type": "both",
    					"topologyPollingPeriod": "3600",
    					"metricPollingPeriod": "240",
    					"backendgroup": "group",
    					"thread": {
    					  "poolsize": "3"
    					},
    					"dmconnection": {
    					  "poolsize": "3"
    					}
    				  }
    				]
    			  }
    			},
    			"kafka": {
    			  "cluster": {
    				"node": [
    				  {
    					"host": "localhost",
    					"port": "9092"
    				  }
    				],
    				"topic": "default-topic",
    				"authType": "SASL_PLAINTEXT",
    				"username": "admin",
    				"password": "{B07EA85D8D516D4CA4201CFC8DEBEE022E6DE44C0AE6CB9652FC850F08859AFF5A93A33A85220F3E9E1719D3595D6AA7}"
    			  }
    			}
    		  }
    		}
  12. Delete block:
    Request : curl --cacert /opt/DCF/Tools/Controller/Default/cert.pem -u admin:changeme --request DELETE   --url https://127.0.0.1:8443/dcc/v1/catalog/blocks/smarts-metrics035f8121-aaed-4d66-83eb-ae3a7841f720
    
    	Response : {"instanceId": "smarts-metrics035f8121-aaed-4d66-83eb-ae3a7841f720", "message": "Block instance successfully deleted", "time": "2019-04-09 05:42:21.204886"}