curl samples

Replace USERNAME, PASSWORD and the placeholders in capitals.

Obtain an API key

curl -X POST https://consumer.qa.data.spglobal.com/apikey -d username=USERNAME -d password=PASSWORD

Latest records of an entity

curl -H "Authorization: Bearer APIKEY" "https://consumer.qa.data.spglobal.com/NAMESPACE/ENTITY/latest?limit=10"

Records in a time range

curl -H "Authorization: Bearer APIKEY" "https://consumer.qa.data.spglobal.com/NAMESPACE/ENTITY/timeseries?id=ID1&from=2024-01-01&to=2024-01-31&limit=1000&envelope=true"

The next page

curl -H "Authorization: Bearer APIKEY" "https://consumer.qa.data.spglobal.com/NAMESPACE/ENTITY/timeseries?id=ID1&from=2024-01-01&to=2024-01-31&limit=1000&envelope=true&after=AFTER_VALUE"

The first message after the end of the stream

curl -H "Authorization: Bearer APIKEY" "https://consumer.qa.data.spglobal.com/NAMESPACE/stream?after=head"

A range filter

Quote the URL, because < and > have a meaning in a shell:

curl -H "Authorization: Bearer APIKEY" "https://consumer.qa.data.spglobal.com/NAMESPACE/ENTITY/latest?asOf>=2024-01-01Z&asOf<=2024-01-31Z"

Save a response to a file

curl -H "Authorization: Bearer APIKEY" -o result.csv "https://consumer.qa.data.spglobal.com/NAMESPACE/ENTITY/latest?format=CSV&limit=1000"