# Can't Get CLI To Work Properly

**URL:** <https://forums.interworx.com/t/cant-get-cli-to-work-properly/14184>\
**Category:** General Discussion\
**Tags:** siteworx, dns, cli\
**Created:** [May 30, 2017, 1:01pm UTC](https://forums.interworx.com/t/cant-get-cli-to-work-properly/14184 "2017-05-30T13:01:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Synthetisoft](https://forums.interworx.com/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@Synthetisoft](https://forums.interworx.com/u/Synthetisoft)\
**Post date:** [May 30, 2017, 1:01pm UTC](https://forums.interworx.com/t/cant-get-cli-to-work-properly/14184/1 "2017-05-30T13:01:52Z")

</div>

I’m trying to list all the zones from Siteworx CLI. I also need to add a bunch of A records. Here’s the result:

```auto
siteworx -u -n -v -c Dns -a records --zone_id 72 -o json  
iw_action_name : [B]This input is required[/B]

```

In that example I’m trying to list all the records for zone 72. What am I doing wrong? I try -h and it’s not giving me any insight. Like I said, I also need to add A records. I have to do this all in non-interactive mode (-n).

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [May 30, 2017, 6:09pm UTC](https://forums.interworx.com/t/cant-get-cli-to-work-properly/14184/2 "2017-05-30T18:09:12Z")

</div>

Hi Synthetisoft  
I hope your well  
I am not sure what your trying to achieve but I hope below helps you a little. You can change master.url to one of your hosted domains to test with and change the --host ww3.master.url to match your test, also chnage IP from 10.0.1.1 to your required  
I hope that helps a little and makes it easier to understand  
Many thanks  
John

To list zones for domain  
siteworx -u --login\_domain=master.url -v -n -c Dns -a listZones  
25 master.url 1 0 master master.url  
27 s-alias.url 1 0 pointer master.url  
Command executed: siteworx -u --login\_domain [DOMAIN] -n -c Dns -a listZones  
To add A record to a zone  
siteworx -u --login\_domain=master.url -v -n -c Dns -a addA --host ww3.master.url --ipaddress 10.0.1.1 --zone\_id 25

 ![cli siteworx add.png](https://forums.interworx.com/uploads/default/original/1X/9e197d50991df699edc1f0f6ca34aecc5408b4e5.png)

---

<div class="post-metadata">

**Author:** ![Synthetisoft](https://forums.interworx.com/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@Synthetisoft](https://forums.interworx.com/u/Synthetisoft)\
**Post date:** [May 30, 2017, 7:30pm UTC](https://forums.interworx.com/t/cant-get-cli-to-work-properly/14184/3 "2017-05-30T19:30:46Z")

</div>

[QUOTE=d2d4j;29823]Hi Synthetisoft  
I hope your well  
I am not sure what your trying to achieve but I hope below helps you a little. You can change master.url to one of your hosted domains to test with and change the --host ww3.master.url to match your test, also chnage IP from 10.0.1.1 to your required  
I hope that helps a little and makes it easier to understand  
Many thanks  
John

To list zones for domain  
siteworx -u --login\_domain=master.url -v -n -c Dns -a listZones  
25 master.url 1 0 master master.url  
27 s-alias.url 1 0 pointer master.url  
Command executed: siteworx -u --login\_domain [DOMAIN] -n -c Dns -a listZones  
To add A record to a zone  
siteworx -u --login\_domain=master.url -v -n -c Dns -a addA --host ww3.master.url --ipaddress 10.0.1.1 --zone\_id 25[/QUOTE]

Thanks for that. I’m also trying to list the records in a zone.

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [May 31, 2017, 1:13pm UTC](https://forums.interworx.com/t/cant-get-cli-to-work-properly/14184/4 "2017-05-31T13:13:56Z")

</div>

Hi Synthetisoft  
Ah sorry, please try this but change as needed. The y at the end is yes for save or n for no save, but if no save will abort  
Many thanks  
John  
siteworx -u --login\_domain=master.url -v -n -c Dns -a queryDnsRecords --zone\_id 25 y  
My test result  
309 25 master.url A ipv4.master.url {ipv4} 43200  
310 25 master.url A mail.master.url {ipv4} 43200  
311 25 master.url A master.url {ipv4} 43200  
383 25 master.url A ww2.master.url 10.0.1.1 43200  
384 25 master.url A ww3.master.url 10.0.1.1 43200  
312 25 master.url CNAME ftp.master.url master.url 43200  
313 25 master.url CNAME [www.master.url](http://www.master.url) master.url 43200  
316 25 master.url MX master.url 10 mail.master.url 43200

Command executed: siteworx -u --login\_domain [DOMAIN] -n -c Dns -a queryDnsRecords --zone\_id 25

---

<div class="post-metadata">

**Author:** ![Synthetisoft](https://forums.interworx.com/letter_avatar_proxy/v4/letter/s/9de053/32.png) [@Synthetisoft](https://forums.interworx.com/u/Synthetisoft)\
**Post date:** [June 22, 2017, 5:53am UTC](https://forums.interworx.com/t/cant-get-cli-to-work-properly/14184/5 "2017-06-22T05:53:44Z")

</div>

[QUOTE=d2d4j;29826]Hi Synthetisoft  
Ah sorry, please try this but change as needed. The y at the end is yes for save or n for no save, but if no save will abort  
Many thanks  
John  
siteworx -u --login\_domain=master.url -v -n -c Dns -a queryDnsRecords --zone\_id 25 y  
My test result  
309 25 master.url A ipv4.master.url {ipv4} 43200  
310 25 master.url A mail.master.url {ipv4} 43200  
311 25 master.url A master.url {ipv4} 43200  
383 25 master.url A ww2.master.url 10.0.1.1 43200  
384 25 master.url A ww3.master.url 10.0.1.1 43200  
312 25 master.url CNAME ftp.master.url master.url 43200  
313 25 master.url CNAME [www.master.url](http://www.master.url) master.url 43200  
316 25 master.url MX master.url 10 mail.master.url 43200

Command executed: siteworx -u --login\_domain [DOMAIN] -n -c Dns -a queryDnsRecords --zone\_id 25[/QUOTE]

Thanks. What is it saving if it’s just listing them? I’m also trying to delete a record like this:

siteworx -u --login\_domain=[site.com](http://site.com) -v -  
n -c Dns -a delete --host [sub.site.com](http://sub.site.com) --zone\_id 72 --rec  
ord\_id=2399

But it says I need to paas “confirm\_action”

---

<div class="post-metadata">

**Author:** ![d2d4j](https://forums.interworx.com/user_avatar/forums.interworx.com/d2d4j/32/16_2.png) [@d2d4j](https://forums.interworx.com/u/d2d4j)\
**Post date:** [June 22, 2017, 7:49am UTC](https://forums.interworx.com/t/cant-get-cli-to-work-properly/14184/6 "2017-06-22T07:49:27Z")

</div>

Hi Synthetisoft  
Many thanks and I hope your well  
Please have a look at my CLI, as your missing --confirm\_action 1 y and it should work lovely as my test below shows  
I hope that helps a little  
Many thanks  
John  
siteworx -u --login\_domain=master.url -v -n -c Dns -a delete --record\_id 412 --confirm\_action 1 y  
CLI changes made  
siteworx -u --login\_domain=master.url -v -n -c Dns -a addA --host ww8.master.url --ipaddress 10.0.1.1 --zone\_id 25

DNS ‘A’ record successfully added  
Command executed: siteworx -u --login\_domain [DOMAIN] -n -c Dns -a addA --host ww8.master.url --ipaddress 10.0.1.1 --zone\_id 25

Complete  
siteworx -u --login\_domain=master.url -v -n -c Dns -a queryDnsRecords --zone\_id 25 y  
309 25 master.url A ipv4.master.url {ipv4} 43200  
310 25 master.url A mail.master.url {ipv4} 43200  
311 25 master.url A master.url {ipv4} 43200  
383 25 master.url A ww2.master.url 10.0.1.1 43200  
412 25 master.url A ww8.master.url 10.0.1.1 43200  
312 25 master.url CNAME ftp.master.url master.url 43200  
313 25 master.url CNAME [www.master.url](http://www.master.url) master.url 43200  
316 25 master.url MX master.url 10 mail.master.url 43200

Command executed: siteworx -u --login\_domain [DOMAIN] -n -c Dns -a queryDnsRecords --zone\_id 25

Complete  
siteworx -u --login\_domain=master.url -v -n -c Dns -a delete --record\_id 412 --confirm\_action 1 y

DNS record successfully deleted  
Command executed: siteworx -u --login\_domain [DOMAIN] -n -c Dns -a delete --confirm\_action all --record\_id 412

Complete  
siteworx -u --login\_domain=master.url -v -n -c Dns -a queryDnsRecords --zone\_id 25 y  
309 25 master.url A ipv4.master.url {ipv4} 43200  
310 25 master.url A mail.master.url {ipv4} 43200  
311 25 master.url A master.url {ipv4} 43200  
383 25 master.url A ww2.master.url 10.0.1.1 43200  
312 25 master.url CNAME ftp.master.url master.url 43200  
313 25 master.url CNAME [www.master.url](http://www.master.url) master.url 43200  
316 25 master.url MX master.url 10 mail.master.url 43200

Command executed: siteworx -u --login\_domain [DOMAIN] -n -c Dns -a queryDnsRecords --zone\_id 25

Complete
