Note that the result is displayed as text, but if you request
whitePages.xml
, you obtain an XML result.
Likewise,
whitePages.json
allows you to obtain a JSON result. The
html
extension even allows you to
display a rough interface where you can modify values in real time. The whole REST API is available
in these different formats.
Driving a module through the REST interface
Each Yoctopuce module has its own REST interface, available in several variants. Let us imagine a
Yocto-Display with the
YD128X32-12345
serial number and the
myModule
logical name. The
following URL allows you to know the state of the module.
http://127.0.0.1:4444/bySerial/YD128X32-12345/api/module.txt
You can naturally also use the module logical name rather than its serial number.
http://127.0.0.1:4444/byName/myModule/api/module.txt
To retrieve the value of a module property, simply add the name of the property below
module
. For
example, if you want to know the signposting led luminosity, send the following request:
http://127.0.0.1:4444/bySerial/YD128X32-12345/api/module/luminosity
To change the value of a property, modify the corresponding attribute. Thus, to modify the luminosity,
send the following request:
http://127.0.0.1:4444/bySerial/YD128X32-12345/api/module?luminosity=100
Driving the module functions through the REST interface
The module functions can be manipulated in the same way. To know the state of the display function,
build the following URL:
http://127.0.0.1:4444/bySerial/YD128X32-12345/api/display.txt
Note that if you can use logical names for the modules instead of their serial number, you cannot use
logical names for functions. Only hardware names are authorized to access functions.
You can retrieve a module function attribute in a way rather similar to that used with the modules. For
example:
http://127.0.0.1:4444/bySerial/YD128X32-12345/api/display/logicalName
Rather logically, attributes can be modified in the same manner.
http://127.0.0.1:4444/bySerial/YD128X32-12345/api/display?logicalName=myFunction
You can find the list of available attributes for your Yocto-Display at the beginning of the
Programming
chapter.
Accessing Yoctopuce data logger through the REST interface
This section only applies to devices with a built-in data logger.
The preview of all recorded data streams can be retrieved in JSON format using the following URL:
http://127.0.0.1:4444/bySerial/YD128X32-12345/dataLogger.json
Individual measures for any given stream can be obtained by appending the desired function
identifier as well as start time of the stream:
21. Using with unsupported languages
128
www.yoctopuce.com
Summary of Contents for Yocto-Display
Page 1: ...Yocto Display User Manual...
Page 2: ......
Page 40: ...34 www yoctopuce com...
Page 52: ...46 www yoctopuce com...
Page 84: ...78 www yoctopuce com...
Page 92: ...86 www yoctopuce com...
Page 130: ...124 www yoctopuce com...
Page 422: ...416 www yoctopuce com...