Some websites provide a link to a dataset (in Excel sheets format) which allows the dataset to be downloaded. But some others additionally provide API documentation, like this site. Can you please refer tutorials that explains about this concept, as well as how one may use it?
The API you've linked to is the HTTP API documentation, so you would need to able to perform HTTP requests to send get and post requests to the endpoint. Depending on your programming language of choice there are a ton of tutorials available, for example in python: https://www.datacamp.com/tutorial/making-http-requests-in-python or https://www.geeksforgeeks.org/get-post-requests-using-python/
I don't know of tutorials for downloading from that specific provider, but the mechanics of http requests using the python requests library are roughly equivalent. For https://data.medicaid.gov/datasets, click on a specific dataset, then scroll to dataset API. From here you can get a single dataset, and if you click on the down arrow to the right of the text box you can try it out - button on the right. Then hit the Execute button and it will show you the curl commands and actually execute them as well as the request URL. So for example NADAC 2023, it will show https://data.medicaid.gov/api/1/metastore/schemas/dataset/items/4a00010a-132b-4e4d-a611-543c9521280f?show-reference-ids=false
This can be (roughly) translated into python using the requests library as
response = requests.get('https://data.medicaid.gov/api/1/metastore/schemas/dataset/items/a217613c-12bc-5137-8b3a-ada0e4dad1ff/')
Of course, you then need to parse the response to find the actual location of the dataset ("downloadURL": "https://download.medicaid.gov/data/nadac-national-average-drug-acquisition-cost-09-06-2023.csv",) resend another request to download the actual data, and so on.