Sorry that I have to "answer" you question when I should actually "comment" to ask if you're okay with using a python module instead of a REST API (not enough reputation).
Anyway, I love playing with stock data, here is my method for getting it for free in python and exporting it to a csv.
pip install yfinance
import yfinance as yf
import pandas as pd
sp500 = yf.Ticker('^GSPC')
sp500_hist = sp500.history(period='1y')
This will provide you with daily data, open high low close and volume. Not sure how familiar you are with pandas, but if you only want closing prices, subset your dataframe like this:
or if you want volume as well: