US National Level

The following API endpoints are pulling data from the New York Times US National Level dataset. You can find and download the original data from github.com/nytimes/covid-19-data/blob/master/us.csv

GETapi/covid19/nytimes/national

Full URL: https://api.joeczubiak.com/api/covid19/nytimes/national

date optional

string

Filters the results to a specific date. Format yyyy-mm-dd. Example "2020-04-09"

cases optional

integer

Filters the data to only those with cases equaling the number provided.

deaths optional

integer

Filters the data to only those with deaths equaling the number provided.

page optional

integer

Default: 1

Set to the pagination page number you wish to receive.

per_page optional

integer

Default: 100

The number of results to be returned from the request.

order optional

string

Default: asc

Specifies the order to sort the results. Accepts "asc" or "desc."

order_by optional

string

Default: date

Orders the content by a particular field. Specify the field.

The following is a sample response in the format you will receive from making a request.

              
{
  "data": [
    {
      "date": "2020-04-14",
      "cases": 607318,
      "deaths": 26081
    },
    ...
  ],
  "status": "200",
  "links": {
    "first": "https://api.joeczubiak.com/api/covid19/nytimes/national?page=1",
    "last": "https://api.joeczubiak.com/api/covid19/nytimes/national?page=1",
    "prev": null,
    "next": null
  },
  "attribution": {
    "required": true,
    "message": "You must provide attribution when using this data.",
    "sample_attribution_text": "This data is being provided free from the NY Times.",
    "commercial_uses_allowed": false
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "path": "https://api.joeczubiak.com/api/covid19/nytimes/national",
    "per_page": 100,
    "to": 85,
    "total": 85
  }
}
              
            
          
const fetch = require('node-fetch');

fetch('https://api.joeczubiak.com/api/covid19/nytimes/national', {
  method: 'GET',
  headers: {
    'Accept': 'application/json'
  }
})
.then(response => {
  console.log(
    `Response: ${response.status}`
  );
  return response.json();
})
.then(json => console.log(json))
.catch(err => console.error(err));