Adding a REST like web api and introducing Json.NET
Adds the ability to handle simple REST like api calls to the Webserver. If a POST request is received by the webserver it calls HttpServer::HandlePostRequest "Get" Action Example: http://localhost:8085/Sensor?action=Get&id=/ltc/example/0 This will return a JSON response containing either the value of the Sensor or an error message. Example response: If it succeeded: { "result" : "ok", "value" : "42" } If it failed: { "result" : "fail" , "message" : "Some error message" } "Set" Action Example: http://localhost:8085/Sensor?action=Set&id=/ltc/example/0&value=42.0 This will try to set the Control value of the specified Sensor. Example response: If it succeeded: { "result" : "ok" } If it failed: { "result" : "fail" , "message" : "Some error message" } The TestScripts folder contains 3 python scripts that demonstrate the usage of the WebServer and the WMI provider.
This commit is contained in:
@@ -58,10 +58,15 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Newtonsoft.Json.10.0.3\lib\net20\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
@@ -168,6 +173,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Resources\app.manifest">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
@@ -303,6 +309,7 @@
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent></PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user