I’m currently working on PHP based SDK that communicate through a smart web service app. Everything was working fine (list devices, send commands to devices, show devices states, …) until I started trying to add subscriptions.
I created a smartapp that relays all graph call through a “mappings” section like the one below :
mappings {
path("/:deviceType") {
action: [
GET: "list"
]
}
path("/:deviceType/states") {
action: [
GET: "listStates"
]
}
path("/:deviceType/subscriptions") {
action: [
POST: "addSubscription"
]
}
path("/:deviceType/subscriptions/:id") {
action: [
DELETE: "removeSubscription"
]
}
path("/:deviceType/:id") {
action: [
GET: "show",
PUT: "update"
]
}
path("/subscriptions") {
action: [
GET: "listSubscriptions"
]
}
}
Then I’m calling that graph url : https://graph.api.smartthings.com/api/smartapps/installations/{id_endpoint}/switches/subscriptions
which is supposed to be mapped by that part of the code mappings section
path("/:deviceType/subscriptions") {
action: [
POST: "addSubscription"
]
}
But it never gets triggered except if I replace “:deviceType” eg by “switches”
Why :deviceType isn’t matched with the right part of the graph url as it always does with all other mappings ?
Any help would be greatly appreciated