I am working on a C# project.
I get data from a third-party API in JSON format. I further use JSON output in my C# project. But third party API owners update their data every 30 minutes. I need to re-download that file every 30 minutes then use it in my C# project. I want to do this programmatically.
Issues: How can I download that API response( JSON file) programmatically into my project folder?
Confusion: Can I download the API response JSON file using C# or JavaScript?
Yes you can. I don't know C# but in Javascript you can do this..
for example if you are using axios to fetching api data,
const fs = require('fs')
const axios = require('axios')
axios.get('/api').then(res =>
fs.writeFile('file.json', res.data, err =>{
if(err){
console.log(err)
}else{
console.log('success')
}
})
)