US State Level

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

GETapi/covid19/nytimes/state

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

date optional

string

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

state optional

string

Filters the data to state provided. Full state name required. Eg California

fips optional

string

Filters the results to the fips provided. (The FIPS code is a code given to the state by the federal government.)

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",
      "state": "Wyoming",
      "fips": "56",
      "cases": 282,
      "deaths": 1
    },
    ...
  ],
  "status": "200",
  "links": {
    "first": "https://api.joeczubiak.com/api/covid19/nytimes/state?page=1",
    "last": "https://api.joeczubiak.com/api/covid19/nytimes/state?page=24",
    "prev": null,
    "next": "https://api.joeczubiak.com/api/covid19/nytimes/state?page=2"
  },
  "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": 24,
    "path": "https://api.joeczubiak.com/api/covid19/nytimes/state",
    "per_page": 100,
    "to": 100,
    "total": 2385
  }
}
              
            
          
const fetch = require('node-fetch');

fetch('https://api.joeczubiak.com/api/covid19/nytimes/state', {
  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));