Skip to content

VarnaLab/varnalab-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VarnaLab API

travis-ci coveralls-status

Table of Contents

Origin

https://simo.varnalab.org/api[API Endpoint] # staging
https://api.varnalab.org[API Endpoint] # production

Public API

Auth

GET /auth/login

Login with your GitHub account
{
  "admin": true,
  "jwt": "..."
}

Whois

varnalab-whois

GET /whois/known

All known people
[
  {
    "id": "b0e915e2-e60c-4d4d-a693-343c9c0234c9",
    "name": "Симеон Величков",
    "gravatar": "bc8400cd663c63dbdbc8607870390a20",
    "backer": "Симо V",
    "github": "simov",
    "twitter": "_simov"
  }
]

GET /whois/online

Known and unknown online people and devices
{
  "known": [
    "b93b098c-adb5-48ce-8dd1-8828f39d99d3",
    "42ccbc1a-f0bc-416d-a7f7-f4c6e0910023"
  ],
  "unknown": [
    {
      "id": "6197b1fd-9fb7-473f-bdb9-a9a832065c72",
      "host": "debian",
      "vendor": "Intel Corporate"
    },
    {
      "id": "71c325b8-f123-46d9-847c-97bf45fb37f7",
      "host": "android-cae44bf1974b5f66",
      "vendor": "Motorola Mobility LLC, a Lenovo Company"
    }
  ]
}

Finance

varnalab-finance

GET /finance

The entire financial data
{
  "income": {...},
  "spend": {...}
}

GET /finance/stats

All financial stats
[
  [...],
  [...]
]

GET /finance/stats/backers

Backers stats
[
  {
    "name": "Тодор Драгнев",
    "monthly": [50,50,50,50,50,80,50,50,0,0,0,0],
    "total": 430,
    "average": 61
  }
]

GET /finance/invbg/cashbox

InvBG Cashbox

Events

GET /events

  • offset 0
  • limit 10
VarnaLab Events Range
[
  {
    "id": "2044728552423780",
    "name": "LoraWAN - TTN Varna meeting September 2017",
    "description": "Отново ще експериментираме с крайните устройства, ще закачим GPS модул и ще си поиграем и с един аналогов осцилоскоп :)",
    "photo": "https://scontent.xx.fbcdn.net/v/t1.0-0/p480x480/20620935_1515230891867157_3034615754728253404_n.jpg?oh=434022dbe5157cd3a75ce45f5b556de6&oe=5A24590D",
    "start_time": "2017-09-16T11:00:00+0300",
    "end_time": "2017-09-16T18:00:00+0300",
    "updated_time": "2017-08-07T13:28:38+0000"
  }
]
  • id Event ID
Single VarnaLab Event
{
  "id": "2044728552423780",
  "name": "LoraWAN - TTN Varna meeting September 2017",
  "description": "Отново ще експериментираме с крайните устройства, ще закачим GPS модул и ще си поиграем и с един аналогов осцилоскоп :)",
  "photo": "https://scontent.xx.fbcdn.net/v/t1.0-0/p480x480/20620935_1515230891867157_3034615754728253404_n.jpg?oh=434022dbe5157cd3a75ce45f5b556de6&oe=5A24590D",
  "start_time": "2017-09-16T11:00:00+0300",
  "end_time": "2017-09-16T18:00:00+0300",
  "updated_time": "2017-08-07T13:28:38+0000"
}

GET /events/past

  • offset 0
  • limit 10
Past Events Range
[
  {
    "id": "2044728552423780",
    "name": "LoraWAN - TTN Varna meeting September 2017",
    "description": "Отново ще експериментираме с крайните устройства, ще закачим GPS модул и ще си поиграем и с един аналогов осцилоскоп :)",
    "photo": "https://scontent.xx.fbcdn.net/v/t1.0-0/p480x480/20620935_1515230891867157_3034615754728253404_n.jpg?oh=434022dbe5157cd3a75ce45f5b556de6&oe=5A24590D",
    "start_time": "2017-09-16T11:00:00+0300",
    "end_time": "2017-09-16T18:00:00+0300",
    "updated_time": "2017-08-07T13:28:38+0000"
  }
]

GET /events/upcoming

Upcoming Events
[
  {
    "id": "2044728552423780",
    "name": "LoraWAN - TTN Varna meeting September 2017",
    "description": "Отново ще експериментираме с крайните устройства, ще закачим GPS модул и ще си поиграем и с един аналогов осцилоскоп :)",
    "photo": "https://scontent.xx.fbcdn.net/v/t1.0-0/p480x480/20620935_1515230891867157_3034615754728253404_n.jpg?oh=434022dbe5157cd3a75ce45f5b556de6&oe=5A24590D",
    "start_time": "2017-09-16T11:00:00+0300",
    "end_time": "2017-09-16T18:00:00+0300",
    "updated_time": "2017-08-07T13:28:38+0000"
  }
]

Articles

GET /articles

Articles

Admin API

Authorization Bearer [Admin JWT]

POST /whois/known

Add new known user
{
  "id": ""
}

PATCH /whois/known/:id

Update known user
{
  "id": ""
}

DELETE /whois/known/:id

Delete known user
{
  "id": ""
}

Slack API

POST /slack/whois

Slack attachments: Whois Online in VarnaLab

POST /slack/events

Slack attachments: Upcoming Events in VarnaLab


Module

Configuration

{
  "development": {
    "db": {
      "users": "/path/to/users.json",
      "devices": "/path/to/devices.json",
      "online": "/path/to/online.json",
      "finance": "/path/to/finance.json",
      "stats": "/path/to/stats.json",
      "invbg": "/path/to/invbg.json",
      "events": "/path/to/events.json"
    },
    "auth": {
      "public": "/path/to/public.pem",
      "private": "/path/to/private.pem"
    },
    "github": {
      "connect": "/oauth/connect/route",
      "team": "[Team ID]"
    },
    "slack": {
      "token": "[WebHook Token]"
    }
  }
}

API

var server = express()
var api = require('varnalab-api')
var config = {...}
server.use(api(config))
server.listen(3000)

Server

node bin/ --config /path/to/config.json

Releases

No releases published

Packages

No packages published