Skip to content

kaskadi/push-api

Repository files navigation

GitHub Actions workflows status

Deploy status Build status Docs generation status

CodeClimate


API endpoints

The origin and root path for this API is: https://api.klimapartner.net/push

The following endpoints are defined in this API:

/public-key

Supported methods:

GET (target lambda → get-public-key)

Description:

This endpoint returns the public key used in the push-notification protocol. For now it only returns the public key related to the Kaskadi project!

Authorization:

Type Identity source
Cognito
  • method.request.header.Authorization

Query string parameters:

No query string parameters found for this method.

Request body:

No body found for this method.

Examples:

Example #1

Request:

GET https://api.klimapartner.net/push/public-key

Headers:
  Authorization: Bearer COGNITO_ACCESS_TOKEN

Response:

Status code:
  200

Headers:
  Access-Control-Allow-Origin: *

Body:
  {
    "publicKey": "kaskadi_push_notification_public_key"
  }

/register

Supported methods:

POST (target lambda → register-sub)

Description:

This endpoint allows a client to register for push-notification. The body should contain subscription data as defined here.

Authorization:

Type Identity source
Cognito
  • method.request.header.Authorization

Query string parameters:

No query string parameters found for this method.

Request body:

Key Default Description
endpoint Client endpoint for the push-notification system.
keys Object - set of keys used for authenticaton when pushing notification to the client.

Examples:

Example #1

Request:

POST https://api.klimapartner.net/push/register

Headers:
  Authorization: Bearer COGNITO_ACCESS_TOKEN

Body:
  {
    "endpoint": "https://fcm.googleapis.com/fcm/send/dpH5lCsTSSM:APA91bHqjZxM0VImWWqDRN7U0a3AycjUf4O-byuxb_wJsKRaKvV_iKw56s16ekq6FUqoCF7k2nICUpd8fHPxVTgqLunFeVeB9lLCQZyohyAztTH8ZQL9WCxKpA6dvTG_TUIhQUFq_n",
    "keys": {
      "p256dh": "BLQELIDm-6b9Bl07YrEuXJ4BL_YBVQ0dvt9NQGGJxIQidJWHPNa9YrouvcQ9d7_MqzvGS9Alz60SZNCG3qfpk=",
      "auth": "4vQK-SvRAN5eo-8ASlrwA=="
    }
  }

Response:

Status code:
  201

Headers:
  Access-Control-Allow-Origin: *

Body:
  {
    "message": "Subscriptions successfully registered!"
  }

API resources

The following lambda functions are used in this API:

The following layers are used in this API:

register-sub

Name Sources Timeout Handler Layers
register-sub
  • HTTP (POST)
default handler

See configuration file for more details.

get-public-key

Name Sources Timeout Handler Layers
get-public-key
  • HTTP (GET)
default handler

See configuration file for more details.

push-api-layer

Description

Layer for push-api

Dependencies

  • aws-es-client, version: 1.0.2 (see on NPM)
  • create-es-client (local utility)

See configuration file for more details.

Stack tags

You can use any tags (and their respective values) visible below to find ressources related to this stack on AWS. See here for more details.

Tag Value
app kaskadi
service push-api
logical-unit push
type http

About

API to manage push notification subscriptions

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •