Here is an action in my TD:
"set_relay": {
"description": "Turn on/off the relay",
"safe": false,
"idempotent": false,
"uriVariables": {
"state":{
"type": "integer",
"minimum": 0,
"maximum": 1
}
},
"forms": [
{
"href": "/relay{?state}",
"op": "invokeaction",
"contentType": "application/json",
"htv:methodName": "GET"
}
]
}
When I run "thing.invokeAction("set_relay", undefined,{ 'uriVariables': { 'state': '0' }})" the consumer says : "[binding-http] HttpClient (invokeResource) sending POST to http://thing_ip/relay?state=0". But I want it to be a http GET, that's why I set "htv:methodName": "GET".
If I change the TD to :
"set_relay": {
"description": "Turn on/off the relay",
"safe": false,
"idempotent": false,
"forms": [
{
"href": "/relay",
"op": "invokeaction",
"contentType": "application/json",
"htv:methodName": "GET"
}
]
}
It says: [binding-http] HttpClient (invokeResource) sending GET to http://thing_ip/relay
So I think it is related to the fact that I use a uriVariable.
Here is an action in my TD: "set_relay": { "description": "Turn on/off the relay", "safe": false, "idempotent": false, "uriVariables": { "state":{ "type": "integer", "minimum": 0, "maximum": 1 } }, "forms": [ { "href": "/relay{?state}", "op": "invokeaction", "contentType": "application/json", "htv:methodName": "GET" } ] }
When I run "thing.invokeAction("set_relay", undefined,{ 'uriVariables': { 'state': '0' }})" the consumer says : "[binding-http] HttpClient (invokeResource) sending POST to http://thing_ip/relay?state=0". But I want it to be a http GET, that's why I set "htv:methodName": "GET".
If I change the TD to : "set_relay": { "description": "Turn on/off the relay", "safe": false, "idempotent": false, "forms": [ { "href": "/relay", "op": "invokeaction", "contentType": "application/json", "htv:methodName": "GET" } ] } It says: [binding-http] HttpClient (invokeResource) sending GET to http://thing_ip/relay
So I think it is related to the fact that I use a uriVariable.
Or maybe I am doing something wrong?