node.js - 有没有办法使用nodejs在Godaddy域中创建/更新 'A'类型记录?

标签 node.js ajax godaddy-api

假设我有一个域“example.com”。我想用一些 TTL 值更新“A”类型记录,例如“test”,以获得域“test.example.com”。我们如何在 Node.js 中做到这一点?有可用的模块吗?提前致谢!

我尝试了以下ajax请求。但它显示错误。有人可以帮我吗?

$.ajax({
    type: 'PATCH',
    url: 'https://api.ote-godaddy.com/v1/domains/{domain}/records',
    data: {
    'domain': 'example.com',
      'records': [{
         'type': 'A',
         'name': 'test',
         'data': '000.59.47.201'
      }]
    },
    headers: {
      'Authorization': 'sso-key {key}:{secret}',
      'Content-Type': 'application/json',
      'Access-Control-Allow-Origin': '*'
    },
    success: function(body) {
      console.log(body);
    }
  });

最佳答案

我怀疑您遇到的 ajax 错误可能是由于 API key 造成的。在 GoDaddy 中,有两种环境可用,称为 ote 和 Production。 对于 ajax API 调用,当您尝试将 ote 环境 key 用于生产 key 时,您将收到错误,反之亦然。

此外,还有一个适用于您的情况的 npm 模块。这是该模块的链接 https://www.npmjs.com/package/godaddy-dns

关于node.js - 有没有办法使用nodejs在Godaddy域中创建/更新 'A'类型记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55370909/

相关文章:

azure - 自定义域以及如何通过 http ://访问网站

angularjs - http-server 未在 systemd 中启动

node.js - Hyperledger 结构中带有芒果查询的非法缓冲区?

javascript - Internet Explorer 上的 jquery ajax 问题

mysql - 删除内容时 Godaddy 数据库存储不会降低

lets-encrypt - 无法使用 traefik v2 和 Godaddy 获得通配符证书

node.js - NPM 从 GitHub 拉取错误版本

node.js - 删除 html 标签 - JSDOM

javascript - Ajax 仅将字符串化数组的第一个索引返回给 Spring Controller

php - 从 AJAX 调用 Php 函数不起作用