Web service app : Mapping subscriptions

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

@mdementen did you ever figure this out? Sorry for the naive question, but what is the purpose of adding subscriptions?

I’m trying to figure out how to build something into my PHP endpoint app that allows me to monitor a device’s status, and trigger events in Tasker on Android based on a state change (e.g., motion sensor tripped = something happens).

@mdementen have you been able to get this web services working? If so, are you able to share you php code?