cahayoyo / government-api-mongodb

Fetching Scottish Parliament: Government Roles API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scottish Parliament: Government Roles API

Fetching JSON data with MongoDB and NodeJS

Dependency & Configuration

{
  "name": "governmentroles",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.3",
    "mongodb": "^4.5.0"
  }
}

Running Server

nodemon app

Use postman

The Endpoint List

Get Role List

by default it will only show 10 data per page, add page=x to search specific page

   {
        "_id": "625b2b784702f2d652bf3faf",
        "ID": 1,
        "Name": "Cabinet Secretary for Commonwealth Games, Sport, Equalities and Pensioners' Rights",
        "Notes": ""
    }

Get Role by _id

{
    "_id": "625b2b784702f2d652bf3fb8",
    "ID": 10,
    "Name": "Cabinet Secretary for Health, Wellbeing and Cities Strategy",
    "Notes": ""
}

Delete Role by _id

{
    "acknowledged": true,
    "deletedCount": 1
}

About

Fetching Scottish Parliament: Government Roles API


Languages

Language:JavaScript 100.0%