Forum

Browse topics, discover Works With Legrand community!

Home+Control API - get plants topology - modules info not available

Hi,

When using the API portal Try-it functionality of the get plants topology API I get the following info:

{ "plant": { "id": "000000005d59222367368a000c1f4dcd", "ambients": [{ "id": "5d59222367368a000c1f4dcd51e0ae42", "name": "Woonkamer", "type": "livingroom", "modules": [{ "id": "0000000474246fe000047400000b4035", "name": "Stopcontact", "hw_type": "NLP", "type": "router", "device": "plug" }, { "id": "0000000474246fe00004740000820716", "name": "Piano", "hw_type": "NLF", "device": "light" }, { "id": "0000000474246fe0000474000082071c", "name": "Bureau", "hw_type": "NLF", "device": "light" }, { "id": "0000000474246fe0000474000082070f", "name": "Salon", "hw_type": "NLF", "device": "light" }] }, { "id": "5d59222367368a000c1f4dcd5b5d4526", "name": "Buiten", "type": "outdoor", "modules": [{ "id": "0000000474246fe00004740000820b69", "name": "Tuin", "hw_type": "NLF", "device": "light" }, { "id": "0000000474246fe00004740000820b41", "name": "Deur Tuin", "hw_type": "NLF", "device": "light" }] }, { "id": "5d59222367368a000c1f4dcdc9fca3b4", "name": "Slaapkamer Julie", "type": "bedroom", "modules": [{ "id": "0000000474246fe000047400008a5ea9", "name": "Licht Slaapkamer Julie", "hw_type": "NLF", "device": "light" }] }, { "id": "5d59222367368a000c1f4dcde6a27fda", "name": "Slaapkamer Riet en Danny", "type": "bedroom", "modules": [{ "id": "0000000474246fe00004740000821c80", "name": "Licht 1", "hw_type": "NLF", "device": "light" }] }, { "id": "5d59222367368a000c1f4dcd03c9f3d7", "name": "Badkamer", "type": "bathroom", "modules": [{ "id": "0000000474246fe00004740000821d54", "name": "Licht Badkamer", "hw_type": "NLF", "device": "light" }] }, { "id": "5d59222367368a000c1f4dcd8f799198", "name": "Slaapkamer Emilie", "type": "bedroom", "modules": [{ "id": "0000000474246fe000047400008a0b92", "name": "Licht Slaapkamer Emilie", "hw_type": "NLF", "device": "light" }] }, { "id": "5d59222367368a000c1f4dcd0cc8f6f5", "name": "Toilet tweede verdiep", "type": "toilets", "modules": [{ "id": "0000000474246fe00004740000820719", "name": "Licht Toilet 2de verdiep", "hw_type": "NLF", "device": "light" }] }], "modules": [{ "id": "0000000474246fe00004740000a9bd51", "name": "Vertrek/Aankomst 1", "hw_type": "NLT", "device": "remote" }, { "id": "0000000474246fe00004740000a910e6", "name": "Piano draadloos", "hw_type": "NLT", "device": "remote" }, { "id": "0000000474246fe0000474000079c546", "name": "opstaan/slapen 1", "hw_type": "NLT", "device": "remote" }, { "id": "0000000474246fe0000474000099d885", "name": "Bureau Draadloos", "hw_type": "NLT", "device": "remote" }] } }

Within the web app I'm making I did not receive the info about the modules available in each ambient.
I also did the same API call with the Postman application and same over here:
{"plant":{"id":"000000005d59222367368a000c1f4dcd","ambients":[{"id":"5d59222367368a000c1f4dcd51e0ae42","name":"Woonkamer","type":"livingroom","modules":[]},{"id":"5d59222367368a000c1f4dcd5b5d4526","name":"Buiten","type":"outdoor","modules":[]},{"id":"5d59222367368a000c1f4dcdc9fca3b4","name":"Slaapkamer Julie","type":"bedroom","modules":[]},{"id":"5d59222367368a000c1f4dcde6a27fda","name":"Slaapkamer Riet en Danny","type":"bedroom","modules":[]},{"id":"5d59222367368a000c1f4dcd03c9f3d7","name":"Badkamer","type":"bathroom","modules":[]},{"id":"5d59222367368a000c1f4dcd8f799198","name":"Slaapkamer Emilie","type":"bedroom","modules":[]},{"id":"5d59222367368a000c1f4dcd0cc8f6f5","name":"Toilet tweede verdiep","type":"toilets","modules":[]}],"modules":[{"id":"0000000474246fe00004740000a9bd51","name":"Vertrek/Aankomst 1","hw_type":"NLT","device":"remote"},{"id":"0000000474246fe00004740000a910e6","name":"Piano draadloos","hw_type":"NLT","device":"remote"},{"id":"0000000474246fe0000474000079c546","name":"opstaan/slapen 1","hw_type":"NLT","device":"remote"},{"id":"0000000474246fe0000474000099d885","name":"Bureau Draadloos","hw_type":"NLT","device":"remote"}]}}

So I must be doing something wrong.
Please advice.

Kind regards

Danny

Hi Danny,

I tried to do a GET plant topology request for H+C API with Postman and it seems to work

You will find below a screenshot of my request, please verify that you set the correct parameters

If it's not OK, we will investigate more about your issue

Have a good day,

Leslie - Community Manager

 

"postman-getrequest-hc"

 

 

Hi Lesley,

Below an screenshot of the request in Postman.
I think there are only 3 parameters that can be set:
1. plantid
2. Ocp-Apim-Subscription-Key
3. Authorization

"get

As you can see, I don't get the modules.
I think I'm working with are more recent version of Postman then you.
I also have tempory headers, which is something you can not control in the new version.

"postman
I don't think this can explain the difference in behaviour since I'm also experiencing this problem in my web app where those tempory headers are not used.

Kind regards

Danny

Hello Danny,

According to me, it's a problem with the declared scopes in your application. Especially if you didn't ask for the .read scopes which are mandatory to retrieve your module's list via a GET request of your application

(If you need to ask for new scopes, after your application is accepted, you must redo the access_token and refresh_token process in order your new scopes to be included)

If your scopes are correctly set and if it still doesn't work please send me via the contact form (for your confidentiality) :

- the list of the scopes of your app

- an access_token

Have a good day,

Leslie - Community Manager

Leslie,

i have modified the scope of my application and added explictly the read scope of the lights and the plugs.

I am currently on holiday but if you could in the meantime approve them so that i can test it when i am back home on fridag evening.

Kind regards

 

Danny

 

Leslie,

 

Everything is now working as expected.

Thanks!

 

Kind regards

 

Danny

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Information

watch_later 3 years ago
message5 replies
people2 participants