fivetran trigger historical sync
const axios = require('axios');
const client = axios.create({
auth: {
username: process.env.fivetran_api_key,
password: process.env.fivetran_api_secret
}
})
const base_url = 'https://api.fivetran.com/v1/connectors'
exports.endpoint = async function(req, res) {
try {
const connector_url = `${base_url}/${req.query.connector}`
await client.patch(connector_url, {
is_historical_sync: true,
sync_frequency: 1440,
schedule_type: 'manual'
})
await client.post(`${connector_url}/force`)
} catch(err) {
res.end('error')
}
res.end('success');
}
no comments