我如何使用airtable和wordpress API下载图像,然后在JavaScript中上传到WordPress

发布于 2025-02-12 06:20:33 字数 772 浏览 0 评论 0原文

我希望制作一个自动化脚本,该脚本从Airtable中获取图像并下载并将其上传到WordPress上传文件夹。这些图像应与我为它们创建的空图像字段对所有帖子类型进行回填。例如,我为自己为詹姆斯·少校(James Major)创作了个人资料,并且有一个图像字段,它应该拍摄那张照片并填写。我不知道从哪里开始,因为我是新手编码,而我正在即时学习。感谢您的帮助

enter code here
var base = new Airtable({ apiKey: 'API KEY HERE' }).base('Base key here');

const table = base('USERS');

const getRecords = async() => {
    const records = await table.select({
        maxRecords: 0,
        view: "Website Export"
    }).firstPage();
    console.log(records);
};
getRecords();
const getRecordById = async(id) => {
    try {
        const record = await table.find(id);
        console.log(record)
    } catch (err) {
        console.error(err);
    }
};

// const createRecord
getRecordById(); ```

Im looking to make an automation script that takes images from Airtable and downloads and upload them to Wordpress upload folder. these images should backfill on all the post types with the empty image fields i have created for them. for example say i made a profile for myself James Major and there is an image field, it should take that pic and fill in it. i don't have a clue where to begin as I'm new to coding and i am learning on the fly. thank you for your help

enter code here
var base = new Airtable({ apiKey: 'API KEY HERE' }).base('Base key here');

const table = base('USERS');

const getRecords = async() => {
    const records = await table.select({
        maxRecords: 0,
        view: "Website Export"
    }).firstPage();
    console.log(records);
};
getRecords();
const getRecordById = async(id) => {
    try {
        const record = await table.find(id);
        console.log(record)
    } catch (err) {
        console.error(err);
    }
};

// const createRecord
getRecordById(); ```

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文