Giter Site home page Giter Site logo

Comments (3)

NickUfer avatar NickUfer commented on September 14, 2024 1

Hey, to update a record you need the id of the record. There are two ways of finding the id of a record: via frontend or via api.

The frontend variant (for simply updating the same record over and over again):

  • go to the list of DNS records for your domain
  • click on the edit button of the record you want to know the id
  • when you hover over the save button you can see in the bottom right or left corner of your browser the javascript function which would be called, which includes the id of the record. You can extract it from there. You could also just right click on the save button and copy the link address to clipboard and extract it then.

The api variant (for more dynamic things):

  • call the nameserver.info method (more info on the method here) and filter the returned records for the record you want to update. You could filter here by for example its name and other attributes. The id attribute is the record id in the result.

When you found the record you want to update it is as simple as that:

from INWX.Domrobot import ApiClient, ApiType

username = ''
password = ''
domain = 'yourdomain.com'

api_client = ApiClient(api_url=ApiClient.API_LIVE_URL, api_type=ApiType.JSON_RPC, debug_mode=True)

login_result = api_client.login(username, password)

if login_result['code'] == 1000:

    dns_record_id = 123456789  # our dns record id
    method_params = {
        'id': dns_record_id,
        'content': '1.2.3.4',
    }

    create_record_result = api_client.call_api(api_method='nameserver.updateRecord', method_params=method_params)

    if create_record_result['code'] == 1000:
        print('Record created successfully')
    else:
        raise Exception('Api error while creating the record. Code: ' + str(create_record_result['code'])
                        + '  Message: ' + create_record_result['msg'])
    api_client.logout()
else:
    raise Exception('Api login error. Code: ' + str(login_result['code']) + '  Message: ' + login_result['msg'])

You only need to provide the dns record id and the attributes you want to update. In this example I update only the content (the value) of the record.

Further information about or example what can be updated can be found in our documentation at https://www.inwx.de/en/help/apidoc/f/ch02s13.html#nameserver.updateRecord

I hope I could help 👍🏼

from python-client.

NickUfer avatar NickUfer commented on September 14, 2024

Oops there was a small mistake, just corrected it :) I mentioned the wrong api method in the api variant

from python-client.

TheTesla avatar TheTesla commented on September 14, 2024

The python examples are outdated here: https://www.inwx.de/en/help/apidoc/f/ch01s05.html#idm144
You can check my projects:
https://github.com/TheTesla/dnsuptools
https://github.com/TheTesla/cryptdomainmgr

from python-client.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.