Notifications

Index

Received messages:

Device Keys:

List of all messages

You can get an info by user ID or by currently logged user if you use the string "self", i.e.: https://rest.websupport.sk/v1/user/self/notification

Curl

curl "https://rest.websupport.sk/v1/user/:id/notification" -v -u key:secret

Request

GET https://rest.websupport.sk/v1/user/:id/notification HTTP/1.1

Accept: application/json

Response 200

{
   "items":
   [
       {
           "id": 1,
           "header": "Vystavili sme Vám predfaktúru",
           "body": "long message here",
           "createTime": 1404133478,
           "invoiceId": 204597973,
           "invoicePayTime": 1426162329
       },
       {
           "id": 2,
           "header": "Lorem Ipsum",
           "body": "long message here",
           "createTime": 1404133479,
           "invoiceId": null,
           "invoicePayTime": null
       }
   ],
   "pager":
   {
       "page": 1,
       "pagesize": null,
       "items": 2
   }
}

Get a message detail

Curl

curl "https://rest.websupport.sk/v1/user/:id/notification/:id" -v -u key:secret

Request

GET https://rest.websupport.sk/v1/user/:id/notification/:id HTTP/1.1

Accept: application/json

Response 200

{
    "id": 1,
    "header": "Vystavili sme Vám predfaktúru",
    "body": "long message here",
    "createTime": 1404133478,
    "invoiceId": 204597973,
    "invoicePayTime": 1426162329
}

Response 404 (not found)

{
    "message": "Notification not found!",
    "code": 404
}

Delete a message

Curl

curl "https://rest.websupport.sk/v1/user/:id/notification/:id" -X DELETE -v -u key:secret

Request

DELETE https://rest.websupport.sk/v1/user/:id/notification/:id HTTP/1.1

Accept: application/json

Response 200

{
    "status": "success",
    "item":
    {
        "id": 1,
        "header": "Vystavili sme Vám predfaktúru",
        "body": "long message here",
        "createTime": 1404133478,
        "invoiceId": 204597973,
        "invoicePayTime": 1426162329
    },
    "errors": {}
}

Response 404 (not found)

{
    "message": "Notification not found!",
    "code": 404
}

Send testing message

Curl

curl "https://rest.websupport.sk/v1/user/:id/notification/key/:id/test" -H "Content-Type: application/json" -X POST \ 
 -d '{"header":"Testing message", "body":"Lorem"}' -u key:secret

Request

POST https://rest.websupport.sk/v1/user/:id/notification/key/:id/test HTTP/1.1

Accept: application/json
Content-Type: application/json

{
    "header":"Testing message",
    "body":"Lorem"
}

Response 201 (success)

{
  "status": "success",
  "item": {
    "id": 6,
    "header": "Testing message",
    "body": "Lorem",
    "createTime": 1405685702,
    "invoiceId": null
  },
  "errors": {}
}

List of all notification keys

Curl

curl "https://rest.websupport.sk/v1/user/:id/notification/key" -v -u key:secret

Request

GET https://rest.websupport.sk/v1/user/:id/notification/key HTTP/1.1

Accept: application/json

Response 200

{
   "items":
   [
       {
           "id": 1,
           "key": "1b916ad37dfd5fbd01eb3936427e16b70a641ace",
           "type": "ios",
           "app": "1212118b-36e0-46ca-a66d-254720218902"
       }
   ],
   "pager":
   {
       "page": 1,
       "pagesize": null,
       "items": 1
   }
}

Response 404 (not found)

{
    "message": "User not found.",
    "code": 404
}

Get a key detail

Curl

curl "https://rest.websupport.sk/v1/user/:id/notification/key/:keyId" -v -u key:secret

Request

GET https://rest.websupport.sk/v1/user/:id/notification/key/:keyId HTTP/1.1

Accept: application/json

Response 200

{
   "id": 1,
   "key": "1b916ad37dfd5fbd01eb3936427e16b70a641ace",
   "type": "ios",
   "app": "1212118b-36e0-46ca-a66d-254720218902"
}

Response 404 (not found)

{
    "message": "Key not found.",
    "code": 404
}

Create a notification key

Parameters:

Name Type Required Comment
app string yes unique id for your application, please contat us if you don't have one
secret string yes secret key for your application
key string yes your device token (without spaces)

Please note: app and secret serves as our internal identifier so you don't need to send your google authorization key or apple certificate in this api request and we can support multiple notification systems in one api. If you want to add your own application key, please contact us. For testing purposes use key 1212118b-36e0-46ca-a66d-254720218902 and secret a5a4b63984c4.

Curl

curl "https://rest.websupport.sk/v1/user/:id/notification/key" -H "Content-Type: application/json" -X POST \ 
 -d '{"app":"1212118b-36e0-46ca-a66d-254720218902", "secret": "a5a4b63984c4", "key":"1b916ad37dfd5fbd01eb3936427e16b70a641ace"}' \
 -u key:secret

Request

POST https://rest.websupport.sk/v1/user/:id/notification/key HTTP/1.1

Accept: application/json
Content-Type: application/json

{
    "app":"1212118b-36e0-46ca-a66d-254720218902",
    "secret": "a5a4b63984c4",
    "key":"1b916ad37dfd5fbd01eb3936427e16b70a641ace"
}

Response 201 (success)

{
   "status": "success",
   "item":
   {
       "id": 1,
       "key": "1b916ad37dfd5fbd01eb3936427e16b70a641ace",
       "type": "ios",
       "app": "1212118b-36e0-46ca-a66d-254720218902"
   },
   "errors": {}
}

Response 200 (validator error)

{
   "status": "error",
   "item":
   {
       "id": null,
       "key": "1b916ad37dfd5fbd01eb3936427e16b70a641ace",
       "type": null,
       "app": "1212118b-36e0-46ca-a66d-254720218902"
   },
   "errors":
   {
       "key":
       [
           "Key "1b916ad37dfd5fbd01eb3936427e16b70a641ace" has already been taken."
       ],
       "app":
       [
           "APP uuid not found."
       ]
   }
}

Delete a key

Curl

curl "https://rest.websupport.sk/v1/user/:id/notification/key/:keyId" -X DELETE -v -u key:secret

Request

DELETE https://rest.websupport.sk/v1/user/:id/notification/key/:keyId HTTP/1.1

Accept: application/json

Response 200

{
    "status": "success",
    "item":
    {
        "id": 1,
        "key": "1b916ad37dfd5fbd01eb3936427e16b70a641ace",
        "type": "ios",
        "app": "1212118b-36e0-46ca-a66d-254720218902"
    },
    "errors": {}
}

Response 404 (not found)

{
    "message": "Key not found.",
    "code": 404
}
raw