I wrote a script in python to help you get started. You should be able to extrapolate the below into whatever you are trying to do
#warning: use at your own risk
#dependencies
import requests
import json
import pandas as pd #this is technically not needed, but will probably be if you are to do any kind of analysis
#copy your rpcusername and rpcpassword from your bitcoin.conf file, and keep them inside the 'quotes'
rpcusername = ''
rpcpassword = ''
url = ('http://{0}:{1}@127.0.0.1:8332').format(rpcusername, rpcpassword)
#put the command you want to run here inside 'quotes'
command =
#put any parameters here, if you have none, put 'quotes' with no text ''
#if the parameter is an integer, do not use quotes, otherwise the parameters need to be in 'quotes'
params = ''
data = {'method':command, 'params':[params]}
result = requests.post(url, json=data).json()['result']
print(result)