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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

How to get remote property definition.

vvaidya
1-Newbie

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

1 ACCEPTED SOLUTION

Accepted Solutions
mattl1
1-Newbie
(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
1-Newbie
(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

}

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

Thanks again!

Vishal Vaidya

Top Tags