简体   繁体   中英

Sending push using countly API

I am trying to send a notification using the countly API ,

I found this in the documentation :

curl --request POST \   --url 'https://try.count.ly/i/pushes/prepare?args.apps=args.apps&args.platforms=args.platforms&args=args&api_key=api_key'

It says that i have to provide args which is a JSON object as string with future message data.

They don't provide any clear documentation about how should this arguments be

Any help would be appreciated

Throughout the system Countly expects a stringified JSON object in args parameter. You can look at how it works by sending a message from dashboard and looking at requests in Chrome developer tools, for example. But here we go:

 curl --form 'args={"apps":["57fb679323b5388e28e2c37e"],"platforms":["a"],"tz":false,"test":false}' http://HOST/i/pushes/prepare?api_key=API_KEY

and then

curl --form 'args={"apps":["57fb679323b5388e28e2c37e"],"platforms":["a"],"tz":false,"test":false,"_id":"58cb862e2a16277d4501d787","type":"message","messagePerLocale":{"default":"Message text"},"locales":[{"value":"default","title":"Default","count":1062,"percent":100},{"value":"en","title":"English","count":296,"percent":28},{"value":"ja","title":"Japanese","count":166,"percent":16},{"value":"it","title":"Italian","count":152,"percent":14},{"value":"fr","title":"French","count":152,"percent":14},{"value":"de","title":"German","count":149,"percent":14},{"value":"ko","title":"Korean","count":147,"percent":14}],"sound":"default","source":"dash","date":"2017-03-24T07:00:00.000Z"}' http://HOST/i/pushes/create?api_key=API_KEY

You can also omit first request as described in documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM