The GraphQL-API-Server of "uptime-monitor" project
Easy to use API to save/retrieve all data, related to monitor project.
Available API methods
Create Project
mutation CreateProject {
project(
name:"HAWK",
url:"https://hawk.so",
webhooks: [
"https://notify.bot.ifmo.su/u/iaUh78",
"https://notify.me/iuaSD78"
]
){
name,
url,
webhooks
}
}Update Project
mutation UpdateProject {
project(
id:"5a70ac62e1d8ff5cda8322a0",
name:"Capella",
url:"https://capella.pic",
webhooks: [
"https://notify.bot.ifmo.su/u/iaUh78",
"https://notify.me/iuaSD78"
]
){
name,
url,
webhooks
}
}Parameters
| Parameter | Type | Description |
|---|---|---|
| ID | String | Projects's unique identifier. 24-character hexadecimal string |
| name | String | Project's name |
| url | String | Project's URL |
Retrieve all projects
query AllProjects {
projects {
name,
url,
webhooks
}
}How to send a request?
To test API you can use Insomnia
For cURL request to GraphQL it looks like:
curl -X POST -H "Content-Type: application/json" \
--data '{ "query": "{ projects { name, url } }" }' https://api.monitor.ifmo.su
Deployment
Docker
- Download and setup Docker from the official site
- In project root directory run
docker-compose up --build
Server
- Install PHP@7.2 with required dependencies
add-apt-repository ppa:ondrej/php
apt-get install nginx php php-pear php-dev php-mbstring unzip -y
pecl install mongodb
- Configure php.ini file to add extension=mongodb.so
php --ini
(path for example will be – Loaded Configuration File: /usr/local/etc/php/7.2/php.ini)
echo "extension=mongodb.so" >> /usr/local/etc/php/7.2/php.ini