Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Hi All,
I am trying to get the remote properties of a remote thing. I want to do it programmatically (using services.). To see what are the properties are available at remote thing. Then i can bind or unbind it as per requirement. We can do it in composer by manage binding -> remote tab. I want to see remote properties using service.
Thanks in advance!!!
Regards,
Vishal Vaidya
Solved! Go to Solution.
You can use GetRemoteMetadata:
// result: JSON
Things[ThingName].GetRemoteMetadata();
ThingName should have a Thing Template of 'RemoteThing' in order to see the GetRemoteMetadata service. The service returns JSON, which can then be iterated through:
var remoteData = Things[ThingName].GetRemoteMetadata();
var propertyDefinitions = remoteData.propertyDefinitions;
for(var i in propertyDefinitions)
{
propertyDefinitions.name; //Available remote property name
}
You can use GetRemoteMetadata:
// result: JSON
Things[ThingName].GetRemoteMetadata();
ThingName should have a Thing Template of 'RemoteThing' in order to see the GetRemoteMetadata service. The service returns JSON, which can then be iterated through:
var remoteData = Things[ThingName].GetRemoteMetadata();
var propertyDefinitions = remoteData.propertyDefinitions;
for(var i in propertyDefinitions)
{
propertyDefinitions.name; //Available remote property name
}