Hi,
for my upcoming work on AGPUSH-320 I did think a bit about our current API, especially how the SimplePush part is looking today...
When sending a (SimplePush) notification via the UnifiedPush today it looks like:
curl -3 -u "{PushApplicationID}:{MasterSecret}"
-v -H "Accept: application/json" -H "Content-type: application/json"
-X POST
-d '{
"simple-push": {
"SomeCategory":"version=123",
"anotherCategory":"version=456"
}
}'
https://SERVER:PORT/CONTEXT/rest/sender
This (currently) implies the fact that only one category is possible, per channel/device (will change, as mentioned in above JIRA). But... I think this can lead to some really stupid use-case:
"simple-push": {
"european_financialNews":"version=456",
"earthquake_bayarea":"version=789"
}
A mix like that will not happen, I'd assume... But for me the point is... it really does not make sense to send a few notifications for totally different channels, on ONE request...
This is similar to something like where you send ONE notification to two (or more) totally different native apps (e.g. weatherApp-iOS andWhatsApp).
Not sure what kinda back that really wants ![]()
My suggestion is to change the API a bit, and make it more like we treat the native Android/iOS clients (besides the version limitation from SimplePush):
curl -3 -u "{PushApplicationID}:{MasterSecret}"
-v -H "Accept: application/json" -H "Content-type: application/json"
-X POST
-d '{
"category" : ["German Bundesliga", "UEFA ChampionsLeague"],
"message": {
"alert":"Goal by Marco Reus!",
"sound":"default"
},
"simple-push": "version=someVersionNumberString"
}'
https://SERVER:PORT/CONTEXT/rest/sender
The simple-push key just takes the version=FOO thing (or maybe just the versionNumberString...), instead of submitting a map, where we pass different versions for different channels.
The rest is pretty much similar to what we already do today (at least for Android/iOS):
Note: If no criteria has been specified, we deliver the message (for SP the given version) to all installations of all registered variants... (like we do it already today)
Any thoughts ?
-Matthias