Public | Automated Build

Last pushed: 12 days ago
Short Description
Push HTTP API
Full Description

Push API

Responsible for receiving and storing notifications intended for delivery to identities. Notifications are stored as messages that require acknowledgement.

This API has one DynamoDB Table:

Messages: Hash: identity<String>, Range: sent_at<Integer:Timestamp>

This API responds to a GET:/ for retrieving alerting information.

GET:/messages or PUT:/messages :lock: :earth_americas:

Parameter Required? Type Description Default
:lock: identity yes String The Identity to retrieve messages for
after yes Integer Return data after this specific epoch timestamp
before no Integer Return data before this specific epoch timestamp (Time.now.utc.to_i)

Below is an example response:

[
  ...,
  {
    "sent_at": 1444144597,
    "message": "The notification message contents",
    "acknowledged": "false",
    "tags": {
      "sic": "4abd2bda-7b36-40f0-86e2-84611518f2ed"
    }
  },
  ...

NOTE: This endpopint will check api-payments in order to determine the user's subscription plan and will scramble the text of messages that the user does not have the rights to. It will also emit the follwing headers

X-Total-Messages - the total number of messages
X-Total-Messages-Visible - number of messages the user will be able to see
X-Total-Messages-Hidden - number of messages that have had the text scrambled

POST:/messsages/acknowledge :lock: :earth_americas:

Parameter Required? Type Description Default
:lock: identity yes String The Identity to retrieve messages for
sent_at yes String The timestamp of the message to be acknowledged

This call has no response body. If the message was successfully acknowledged a status of 200 will be returned, 403 otherwise.

POST:/messsages/deliver :lock:

Parameter Required? Type Description Default
:lock: identity yes String The Identity to deliver a message to
sent_at yes String The timestamp of the message to be pushed

Note: Calling this endpoint will push the message to the delivery runner, which attempts to deliver the message instantaneously.

This call has no response body. If the message was successfully acknowledged a status of 200 will be returned, 403 otherwise.

POST:/messsages/deliver/bulk :lock:

Parameter Required? Type Description Default
messages[<identity, sent_at>] yes Array[Hash] Array of message keys to be delivered to their identities

Note: Calling this endpoint will push the message to the delivery runner, which attempts to deliver the message instantaneously.

This call has no response body. If the message was successfully acknowledged a status of 200 will be returned, 403 otherwise.

POST:/messages/send/bulk :lock:

Parameter Required? Type Description Default
message Yes String The message to be sent to all listed identities
tags No Hash[String, String] Tags to be associated with the notification
identities Yes Array[String] The recipient identities for the notification
sent_at No Integer Epoch timestamp to configure the sent time for this notification. Now

Now |

This call has no response body. If the call was successfully executed, a status of 201 will be returned, 400 otherwise.

POST:/messages/send :lock:

Parameter Required? Type Description Default
identity Yes String The recipient identity for the notification
message Yes String The message to be sent to all listed identities
tags No Hash[String, String] Tags to be associated with the notification
sent_at No Integer Epoch timestamp to configure the sent time for this notification. Now

ion. | Now |

This call has no response body. If the call was successfully executed, a status of 201 will be returned, 400 otherwise.

GET:/messages/unacknowledged :lock:

This API endpoint retrieves a list of all identities in the form of Array[<identity:String>] of all unacknowledged messages that have been pushed to this API ?after= a particular timestamp.

Parameter Required? Type Description Default
after No Fixnum The timestamp to retrieve identities that have unacknowledged messages after 2 days ago

Example Response:

[
  ...,
  "us:east:1:....",
  "us:east:1:....",
  "us:east:1:....",
  "us:east:1:....",
  "us:east:1:....",
  "us:east:1:....",
  ...
]

POST:/subscribe :lock: :earth_americas:

Parameter Required? Type Description Default
identity Yes String The recipient identity for the subscription
platform Yes String The platform to subscribe the identity to. Example: "gcm"
id Yes String The ID, used to deliver a message over the associated platform
data No Hash Additional attributes to facilitate message delivery over this platform

Example Response:

{
  "identity" : "us:east:1:...",
  "platform": "gcm",
  "id": "...."
}

DELETE:/subscribe :lock: :earth_americas:

Parameter Required? Type Description Default
identity Yes String The identity for the subscription
platform Yes String The platform to remove from a subscription

GET:/subscribe :lock:

Parameter Required? Type Description Default
identity Yes String The recipient identity for the subscription

Retrieve all the subscriptions for a particular identity.

Example Response:

[
  ...,
  {
    "identity" : "us:east:1:...",
    "platform": "gcm",
    "id": "...."
  },
  ...
]

POST:/alerts_email/token :lock: :earth_americas:

Parameter Required? Type Description Default
:lock: identity yes String The Identity to retrieve messages for

Create an alerts_email unsubscribe token

{
  "identity": "YYYYYYYY"
  "token": "XXXXXXXXXX"
}

POST:/alerts_email/unsubscribe :lock: :earth_americas:

Parameter Required? Type Description Default
:lock: token yes String The token for the unsubscribe

If the call was successfully executed, a status of 201 will be returned, 400 otherwise.

This call will update the user's api-directory alerts_email property to false

{
  "username": "name@example.com"
}
Docker Pull Command
Owner
stockflare
Source Repository

Comments (0)