cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

How to get remote property definition.

vvaidya
1-Visitor

How to get remote property definition.

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

ACCEPTED SOLUTION

Accepted Solutions
mattl1
7-Bedrock
(To:vvaidya)

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

}

View solution in original post

2 REPLIES 2
mattl1
7-Bedrock
(To:vvaidya)

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

}

vvaidya
1-Visitor
(To:vvaidya)

Thank a lot Matt Lang​. This exactly i was looking for.

Thanks again!

Vishal Vaidya

Announcements


Top Tags