To begin receiving notifications, it is necessary to establish your domain and provide evidence of server ownership.
It can be accomplish by 3 simple steps:
* It is important to pay attention on the details in the following steps
* To simplify the steps assume that your REST API is `https://example.com/api`
* be aware our system is communicating with HTTPS only
The steps
dkey
) from our API /api/getWellKnownStats
dkey
given to you by our API is accessible at https://example.com
/.well-known/apihubtech-alerts/your_dkey
example.com
(NOT THE FULL API URL) to our system using the /api/setWellKnown
APIThats it you are done!
dkey
is present and mark your domain as verified/api/add
)/api/getWellKnownStats
Get domain's (wellknown) stats
> From this API can retrieve the domain status and the dkey
, which the dkey
is required by our system for verifying your domain ownership.
API | Method |
---|---|
/api/getWellKnownStats |
GET |
Example Request
curl --location 'https://price-alerts1.p.rapidapi.com/api/getWellKnownStats'
Example Response
{
"status": "ok",
"data": {
"dkey": "DE27FA4B453A4119B0F28EB51E1119975E970DFB",
"domain": example.com,
"verified": 0,
"attempts_left": 3,
"http_code": 404,
"retry_at": "2023-06-11 17:26:24"
}
}
Response Fields
Field | Example | Description |
---|---|---|
domain | example.com | The domain of the server you wish to receive alerts (can be set using /setWellKnown API) |
dkey | DE27FA4B453A4119B0F28EB51E1119975E970DFB | The dkey is the key you are requested to add on your server to proof server ownership |
verified | 0 | Denotes if the given domain has the given dkey at https://your_domain /.well-known/apihubtech-alerts/your_dkey |
http_code | 404 | the returned http code from the http challenge that took place at the specified domain |
retry_at | 2023-06-11 17:26:24 | in case attempts_left reached to 0 then a request can be made again at the specified timestamp |
Set domain
> Set the domain name where the price alerts will be directed to (more details in the table bellow)
API | Method |
---|---|
/api/setWellKnown |
POST |
Example Request
curl --location 'https://price-alerts1.p.rapidapi.com/api/setWellKnown' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'domain=example.com'
Request Fields
Field | Example | Description |
---|---|---|
domain | example.com | The domain of the server you wish to receive alerts (can be set using /setWellKnown API) |
Example Response
{
"status": "ok",
"data": {
"dkey": "DE27FA4B453A4119B0F28EB51E1119975E970DFB",
"domain": example.com,
"verifieuud": 1,
"attempts_left": 2,
"http_code": null,
"retry_at": null,
"result": false
}
}
Response Fields
Field | Example | Description |
---|---|---|
domain | example.com | The domain of the server you wish to receive alerts |
dkey | DE27FA4B453A4119B0F28EB51E1119975E970DFB | The dkey where our system tried to locate and verify on your server |
verified | 1 | Denotes if the given domain has the given dkey at https://your_domain /.well-known/apihubtech-alerts/your_dkey |
http_code | 200 | the returned http code from the http challenge that took place at the specified domain |
retry_at | null | in case attempts_left reached to 0 then a request can be made again at the specified timestamp |
result | true | wether verification was success or failed |
Add Price Alert
> This api is used to generate a price alert. It is required to set a price trigger, symbol pair, direction and your callback url. The callback url is the API that will be called by our system when your price alert is triggered
API | Method |
---|---|
/api/add |
POST |
Example Request
curl --location 'https://price-alerts1.p.rapidapi.com/api/add' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'symbol=EURUSD' \
--data-urlencode 'priceTrigger=1.09661' \
--data-urlencode 'callback=/callback/test' \
--data-urlencode 'direction=bid'
Example Response
{
"status": "ok",
"data": {
"totalAlerts": 4,
"id": 102
}
}
Response Fields
Field | Example | Description |
---|---|---|
totalAlerts | 4 | Total active price alerts |
id | 102 | The id of the newly added price alert |
> *Note:
Notifications will expired after X amount of days passed, depending on your plan
Request Fields
Field | Example | Description |
---|---|---|
priceTrigger | 1.09661 | price trigger for the notification |
symbol | EURUSD | the symbol that the price trigger will be checked (full list at https://price-alerts.apihubtech.com/symbol-list) |
callback | /callback/test | the callback url that will be used to send the notification when it will be triggered |
direction | bid | direction of the price trigger, possible values: [ bid , ask ] |
> *Note:
the domain
will be taken from the wellknown stats, so if your domain is set as example.com
> Then when the notification is triggered, POST request will be made to https://example.com/callbak/test
Example of triggered Notification Send to your system
{
"id": "76",
"symbol": "EURUSD",
"direction": "bid",
"priceTrigger": "1.09667",
"triggered": "2023-05-10 17:26:30",
"sendAt": "2023-05-10 17:26:31"
}
Delete Price Alert
> Can be used to remove an active price alert by sending the id
API | Method |
---|---|
/api/remove |
DELETE |
Example Request
curl --location 'https://price-alerts1.p.rapidapi.com/api/remove' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'symbol=102'
Example Response
{
"status": "ok",
}