Coder Social home page Coder Social logo

readme's Introduction

AMap

CS3216 Assignment 3 Project

Zhu Liang (A0093910H)

  • Front-end Development (Google Maps Integration, APIs)
  • Admin

Heng Rui Yan Ryan (A0108233R)

  • Front-end Development (Ionic Framework, Ionic UI)
  • Floormap Image Creation

Varun Patro (A0131729E)

  • Back-end Development
  • Google Maps Overlay Tiles Generation
  • Database

Dinh Viet Thang (A0126513N)

  • Back-end Development
  • Database

Public API

API

Get all categories


  • URL

    GET /api/category

  • URL Params

  • Data Params

  • Success Response:

    • Code: 200

      Content:

      {
          venues: [{
              name: 'Lecture Theatre',
              catid: '1'
          }, {
              name: 'Tutorial Room',
              catid: '2'
          }, {
              name: 'Laboratory',
              catid: '3'
          }],
          utilities: [{
              name: 'Vending Machine',
              catid: '31'
          }, {
              name: 'Water Cooler',
              catid: '32'
          }, {
              name: 'Toilet',
              catid: '33'
          }, {
              name: 'ATM',
              catid: '34'
          }]
      };
  • Error Response:

    • Code: 400

      Content: ``

  • Sample Call:

Get locations by category


  • URL

    GET /api/category/:catid

  • URL Params

    Required:

    catid=[integer]

    Optional:

  • Data Params

  • Success Response:

    • Code: 200

      Content:

      [ {
          "id": int,
          "name": string,
          "catid": int,
          "position": {
              "lat": float,
              "lng": float
          }
        },
        ...
      ]
  • Error Response:

    • Code: 400

      Content: ``

  • Sample Call:

Facebook authentication


  • URL

    GET /auth/facebook

  • URL Params

  • Data Params

  • Success Response:

    • Code: 302

      Content: redirect to /auth/facebook/callback

  • Error Response:

    • Code: 400

      Content: ``

  • Sample Call:

Facebook authentication callback


  • URL

    GET /auth/facebook

  • URL Params

    Facebook login params

  • Data Params

  • Success Response:

    • Code: 302

      Content: login success

  • Error Response:

    • Code: 400

      Content: ``

  • Sample Call:

Logout


  • URL

    GET /auth/logout

  • URL Params

  • Data Params

  • Success Response:

    • Code: 302

      Content: logout success and redirect to homepage

  • Error Response:

    • Code: 400

      Content: error

  • Sample Call:

Get user profile


  • URL

    GET /api/user/profile

  • URL Params

  • Data Params

  • Success Response:

    • Code: 200

      Content:

      {
          "id":[int],
          "name":[string],
          "facebook_token":[string],
          "createdAt":[date],
          "updatedAt":[date]
      }
  • Error Response:

    • Code: 401

      Content: auth error

  • Sample Call:

Get user's bookmarks


  • URL

    GET /api/user/bookmarks

  • URL Params

  • Data Params

  • Success Response:

    • Code: 200

      Content:

      [
          {
              "id":[int],
              "note":[string],
              "createdAt":[date],
              "updatedAt":[date],
              "UserId":[integer],
              "LocationId":[integer],
              "Location":{
                  "id": [int],
                  "name": [string],
                  "catid": [int],
                  "lat": [float],
                  "lng": [float],
                  "imageUrl": [string],
                  "createdAt":[date],
                  "updatedAt":[date]
              }
          },
          ...
      ]
  • Error Response:

    • Code: 400

      Content: error

    • Code: 401

      Content: auth error

  • Sample Call:

  • Error Response:

    • Code: 400

      Content: ``

    • Code: 401

      Content: auth error

  • Sample Call:

    curl -XGET localhost:3000/api/location?id=7

Create new bookmark


  • URL

    POST /api/bookmark

  • URL Params

  • Data Params

    Required:

    locationId=[integer]

    note=[string]

  • Success Response:

    • Code: 200

    Content:

  • Error Response:

    • Code: 400

      Content: ``

    • Code: 401

      Content: auth error

  • Sample Call:

    curl -XPOST localhost:3000/api/bookmark -d

    {
        "locationId": 7,
        "note": "cs3216 lecture room"
    }

Delete bookmark


  • URL

    DELETE /api/bookmark/:id

  • URL Params

    Required:

    id=[integer]

  • Data Params

  • Success Response:

    • Code: 200

    Content: Number of bookmark affected (which is always 1)

  • Error Response:

    • Code: 400

      Content: Bookmark does not exist or not belong to the user

    • Code: 401

      Content: auth error

  • Sample Call:

    curl -XDELETE localhost:3000/api/bookmark/32

Get locations by location id


  • URL

    GET /api/location

  • URL Params

    Required:

    Optional:

  • Query string

    Required:

    id=[integer]

  • Success Response:

    • Code: 200

      Content:

      {
          "id": int,
          "name": string,
          "catid": int,
          "position": {
              "lat": float,
              "lng": float
          }
      }

Add new locations to the map


  • URL

    POST /api/location

  • Data Params

    [
        {
            "name": string,
            "catid": int,
            "lat": float,
            "lng": float
        },
        ...
    ]
  • Query string

  • Success Response:

    • Code: 200

      Content:

      {
          "id": int,
          "name": string,
          "catid": int,
          "position": {
              "lat": float,
              "lng": float
          },
          "imageUrl": string
      }
  • Error Response:

    • Code: 400

      Content:

  • Sample Call:

    curl -XPOST localhost:3000/api/location -d

    [{
        "name": "test 1",
        "lat": 1.29493,
        "lng": 103.77254,
        "catid": 34
    },
    {
        "name": "test 2",
        "lat": 1.29487,
        "lng": 103.77256,
        "catid": 34
    },
    {
        "name": "test 3",
        "lat": 1.29487,
        "lng": 103.77375,
        "catid": 32
    }]

Update existing location


  • URL

    PUT /api/location

  • Data Params

    [
        {
            "id": int,
            "name": string,
            "catid": int,
            "lat": float,
            "lng": float
        },
        ...
    ]
  • Query string

  • Success Response:

    • Code: 200

      Content:

  • Error Response:

    • Code: 400

      Content: Error

  • Sample Call:

    curl -XPUT localhost:3000/api/location -d

    {
        "name": "test 1",
        "lat": 1.29493,
        "lng": 103.77254,
        "catid": 34
    }

Delete location


  • URL

    DELETE /api/location

  • Data Params

        {
            "id": int
        }
  • Query string

  • Success Response:

    • Code: 200

      Content: ``

  • Error Response:

    • Code: 400

      Content: Error

  • Sample Call:

    curl -XDELETE localhost:3000/api/location -d

    {
        "name": "test 1"
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.