UC Push Service - Push API

Request

App Server can initiate a request to the UC Push Service through the Web Push protocol when pushes a message to a endpoint.

Take Node as an example:

const pushSubscription = {
  endpoint: '< Push Subscription URL >',
  keys: {
    p256dh: '< User Public Encryption Key >',
    auth: '< User Auth Secret >'
  }
};

const payload = '< Push Payload String >';

const options = {
  gcmAPIKey: '< GCM API Key >',
  vapidDetails: {
    subject: '< \'mailto\' Address or URL >',
    publicKey: '< URL Safe Base64 Encoded Public Key >',
    privateKey: '< URL Safe Base64 Encoded Private Key >'
  },
  TTL: <Number>,
  headers: {
    '< header name >': '< header value >'
  },
  contentEncoding: '< Encoding type, e.g.: aesgcm or aes128gcm >',
  proxy: '< proxy server address >'
}

webpush.sendNotification(
  pushSubscription,
  payload,
  options
);

Other language libs, please refer to:https://github.com/web-push-libs/

Response

HTTP Status
body (JSON format)
status
code
message
201
201
Created. The request to send a push message was received and accepted.
400
110
Unknown Content-Encoding
110
Invalid salt value in Encryption header
110
dh value in Crypto-Key header not valid for 01 or earlier webpush-encryption
110
Encryption-Key header not valid for 02 or later webpush-encryption
110
Invalid dh value in Encryption-Key header
401
102
Invalid token
109
Missing authorization header
109
Invalid authorization header
109
Invalid bearer token: No expiration
109
Invalid bearer token: Auth expired
109
Invalid bearer token: Auth > 24 hours in the future
404
120
Origin access Denied.
121
Origin push the user too frequently.
410
106
No such subscription
413
104
Data payload too large, limit is %d bytes, current is %d bytes
500
999
An unexpected server error occurred.