« Utilisateur:Tenbergen/gadgetdata » : différence entre les versions
De Semantic MediaWiki - Sandbox
m (→API code to read it : removed old call that only worked on a different installation) Balise : Éditeur de wikicode 2017 |
mAucun résumé des modifications Balise : Éditeur de wikicode 2017 |
||
Ligne 7 : | Ligne 7 : | ||
== API code to read it == | == API code to read it == | ||
The following will query what the value of [[Property: | The following will query what the value of [[Property:GadgetTestProperty]] for this page: | ||
* '''<nowiki> https://sandbox.semantic-mediawiki.org/w/api.php?action=ask&query=[[Utilisateur:Tenbergen/gadgetdata]]|?GadgetTestProperty&format=json </nowiki>''' | * '''<nowiki> https://sandbox.semantic-mediawiki.org/w/api.php?action=ask&query=[[Utilisateur:Tenbergen/gadgetdata]]|?GadgetTestProperty&format=json </nowiki>''' | ||
The following will return all properties for this page: | The following will return all properties for this page: | ||
* <nowiki> https://sandbox.semantic-mediawiki.org/w/api.php?action=browsebysubject&subject=Utilisateur:Tenbergen/gadgetdata&format=json </nowiki> | * <nowiki> https://sandbox.semantic-mediawiki.org/w/api.php?action=browsebysubject&subject=Utilisateur:Tenbergen/gadgetdata&format=json </nowiki> |
Version du 27 mars 2019 à 00:03
I am setting up a Raspberry Pi that will read a semantic value from this page and use that value to drive a motor - in this context I'll just call it "the gadget".
setting the value
This page encodes as Property:GadgetTestProperty the following:
- 4
- SMW could encode more, but for now let's have one so my gadget doesn't have to error check.
API code to read it
The following will query what the value of Property:GadgetTestProperty for this page:
- https://sandbox.semantic-mediawiki.org/w/api.php?action=ask&query=[[Utilisateur:Tenbergen/gadgetdata]]|?GadgetTestProperty&format=json
The following will return all properties for this page:
- https://sandbox.semantic-mediawiki.org/w/api.php?action=browsebysubject&subject=Utilisateur:Tenbergen/gadgetdata&format=json