Tutorials

Getting started

To get started with Works with Legrand, follow this tutorial. After you complete this guide, you will have a Works with Legrand developer account (congratulation!) and you will be able to try our APIs included in the Starter Kit plan

Step 1 : Create an account

You must Sign-Up to create your account. Thanks to this account, you are now known as a developer within Works with Legrand portal. If you already have a developer account, you just have to Sign-In.

Nota

With this account, you will also be able to use ours (and yours) applications as an “end-user”, but if you already have an “end-user” account, you cannot use it to sign-in within Works with Legrand portal


Step 2 : Subscribe to a product and get subscription key

You need to subscribe to a product to use APIs. When you subscribe to a product, you can use APIs associated to the product.
Click on Subscriptions in the API menu to see available products

 

Access to the subscriptions

 

For now, there is one product, Starter Kit, available for free. This product contains all APIs dedicated to third parties, with a limitation on 100 calls per day and per user.
When you click on the product’s name, you see the list of available APIs, and you can subscribe to the product.

 

Subscription to the Starter Kit

 

Once you confirmed your subscription to an API, you are redirected to your profile account page, where are listed all your subscriptions:

 

Profile with the list of all subscriptions

 

Primary key and Secondary key are unique per subscription and per account. You have to use it into your application to identify your subscription (Ocp-Apim-Subscription-Key parameter in the header of the HTML request).

 

Step 3 : Try-it!

You can test the API directly within Works with Legrand portal.
On the following example, we use the Echo API, a simple API dedicated to test, which does not need a real device to work. To proceed, choose the Create resource of Echo API and then click on Try it

 

Test the APIs with the Try It

 

Concerning this API, and also concerning all our APIs, there are 2 mandatory parameters to put in HTML header:

  • Authorization and Ocp-Apim-Subscription-key is directly filled by the portal. It corresponds to the Primary key or the Secondary key of the API linked to your account.
  • Authorization is the token sent by the user manager service. To get it, select Authorization code in the Authorization section:

 

Parameters to test the Try It

 

If you are not logged in, it opens a sign-in windows, where you must enter your credential linked to your LEGRAND account (developer or end-user account). It automatically fills the Authorization field in the header with the right token:

 

Authorization succeed with the token

 

After that, you can send the message by clicking on Send at the bottom of the page:

 

Sending of the request

 

You will get the answer, with the response status, the latency and the response content:

 

Information about the sent request