vCO Workflow Script to Add REST Operations to a REST Host for vFabric Application Director v5.2 – Part 2

The following script is part 2 and enables the addition of REST Operations to a REST Host for vFabric Application Director v5.2

 

var arrKeys;
	arrKeys = objProperties.keys;

var objRESTOperation;

for ( var i = 0; i < arrKeys.length; i++ )
{
	var strKey;
		strKey = arrKeys[i];

	var arrKey;
		arrKey = strKey.split('-');

	var strMethod;
		strMethod = arrKey[0];

	var strName;
		strName = arrKey[1];

	var strTemplateURL;
		strTemplateURL = objProperties.get(strKey);

	objRESTOperation = new RESTOperation(strName);
	objRESTOperation.method = strMethod;
	objRESTOperation.urlTemplate = strTemplateURL;
	objRESTOperation.defaultContentType = "application/json";

	objRESTOperation = objRESTHost.addOperation(objRESTOperation);
}

RESTHostManager.updateHost(objRESTHost);

Leave a Reply