Skip to content

Latest commit

 

History

History
96 lines (75 loc) · 3.07 KB

File metadata and controls

96 lines (75 loc) · 3.07 KB

API Documentation

Connecting to the API

Since we are running our API locally, we will access the endpoint at the address that appears on your console.

Welcome

  • Method: GET
  • Path: /
  • Query Parameters: None

This page is just a friendly welcome to the API

List

  • Method: GET
  • Path: /api/list
  • Query Parameters: None

Returns records from NYC Air Quality Dataset

Records

  • Method: GET
  • Path: /api/record/<record_id>
  • Parameters = record_id
  • Get data based on UNIQUE_ID

Query Parameters

Output Format

  • format default: json, option: change to csv

Filtering NYC Air Quality

source: NYC Open Data please look at the data dictionary for more insights.

  • Method: GET
  • Path: /api/list
  • Query parameters: -format: json or csv
    • filterby (optional): name of the column to filter the list. Columns:
      • Unique%20ID: Unique record identifier.
      • Indicator%20ID: Identifier of the type of measured value across time and space.
      • Name : Name of Indicator.
      • Measure: How the indicator is measured.
      • Measure%20Info: Information (such as units) about the measure.
      • Geo%20Type%20Name: Geography type; UHF' stands for United Hospital Fund neighborhoods; For instance, Citywide.
      • Geo%20Join%20ID: Identifier of the neighborhood geographic area, used for joining to mapping geography files.
      • Geo%20Place%20Name: Neighborhood name.
      • Time%20Period: Description of the time that the data applies to ; Could be a year, range of years, or season.
      • Start%20Date: Date value for the start of the time_period; Always a date value.
      • Data%20Value: The actual data value for this indicator, measure, place, and time.
      • Message: notes that apply to the data value.
    • filtervalue (optional): value to filter the list by the column specified in filterby.
    • limit (optional): limit the number of results to show.
    • offset (optional): offset the results to show

Sorting (Bonus Feature)

  • sortby : Column name to sort by
  • order : asc (default), desc

Pagination

  • limit : Max limit of number records to return (default: 1000)
  • offset : Number of records to skip (default : 0 )

DATABASE

GET USERS

  • Method: GET
  • Path: /users
  • Parameters = None
  • View data in users table

ADD USERS

  • Method: POST
  • Path: /users/add
  • Parameters = Name, Age, Country
  • Add data in users table

POST USERS

  • Method: POST
  • Path: /users
  • Parameters = Name, Age, Country
  • Add data in users table with both JSON and HTML

GET USER STATS

  • Method: GET

  • Path: /users/stats

  • Parameters = None

  • Add data in users table with both JSON and HTML

  • Example query:

http://127.0.0.1:5000/api/list?format=csv&filterby=Geo%20Place%20Name&filtervalue=Upper&sortby=Data%20Value&order=desc&limit=25&offset=5