Skip to content

vtfk/minelev-api

Repository files navigation

minelev-api

Build Status js-standard-style

Azure functions API for supplying minelev-web with data!

API

All calls requires a valid bearer token from Azure

GET /brreg/:query

Gjør et kall mot brreg og returnerer liste av enheter og underenheter som blir funnet

GET /utdanningsprogrammer

Henter alle utdanningsprogrammer

GET /utdanningsprogrammer/:kode

Henter innholdet for et gitt utdanningsprogram

GET /students

Returns an array of current users students.

Example response

GET /students/:id

Returns an object of given student with available documents

Example response

GET /students/:id/classes

Returns a list of given students classes

Example response

GET /students/:id/documents

Returns a list of given students documents

Example response

POST /students/:id/documents

Adds a new document

Example request and response

GET /classes

Returns a list of the current users classes

Example response

GET /classes/:id

Returns the whole group object with related students and teachers

Example response

GET /classes/:id/students

Returns the students that is members of the specified group

Example response

GET /classes/:id/teachers

Returns the teachers of the specified group

Example response

GET /classes/:id/documents

Returns the documents of the specified group

Example response

GET /documents

Returns documents for all the current users students.

Example response

POST /documents

Creates a new document

Example request and response

POST /documents/preview

Generates a PDF preview of the document

Example request and response

/yff

Head over to docs/yff to read YFF endpoint documentation!

GET /stats

Returns total document count

Example request and response

GET /stats/type

Returns document counts by type

Example request and response

GET /stats/school

Returns document count by school (with type)

Example request and response

GET /stats/type/school

Returns documents by type and school

Example request and response

Development

Prerequisites:

Setup:

  • clone repo
  • install dependencies
  • add a local local.settings.json
{
  "IsEncrypted": false,
  "Values": {
    "FUNCTIONS_WORKER_RUNTIME": "node",
    "AzureWebJobsStorage": "",
    "DEMO": false,
    "DEMO_USER": "[email protected]",
    "PIFU_API_URL": "https://azf-pifu-api.vtfk.no",
    "PIFU_API_JWT": "Secret that should be kept secret!",
    "MONGODB_CONNECTION": "mongodb://mongodb0.example.com:27017",
    "MONGODB_DATABASE": "minelev" ,
    "MONGODB_COLLECTION_YFF": "yff"
  }
}
  • start dev server $ npm run dev

Related

License

MIT