Modify Custom-Fields via CLI-API

I try to set / modify Custom-Fields via CLI-API.

I don’t see how exactly it should work. The documentation leak of an example how exactly to use (modify-custom | Virtualmin — Open Source Web Hosting Control Panel).

I mean you see there, how to call the script, but this doesn’t work in my case… and it doesn’t cover how it would work, if the field-names or field-values have whitespaces inside.

Here is what I’ve tried:

Here I’ve tried to put Fieldname and value in separate double-quotes:

virtualmin modify-custom --domain "19f12d9345jf.test.shop" --set "Customer No." "12345" --set "Email" "customer@123example.com"

Unknown parameter 12345
Sets the values of one or more custom fields for a virtual server

virtualmin modify-custom --domain name
                        <--set "field value">+

Here I’ve tried to write anything in one String for a --set parameter:

virtualmin modify-custom --domain "19f12d9345jf.test.shop" --set "Customer No. 12345" --set "Email customer@123example.com"
No custom field named Customer exists

Sets the values of one or more custom fields for a virtual server

virtualmin modify-custom --domain name
                        <--set "field value">+

Setting a Field during creation of a Server it work like a charm like this with --field-<YourFieldName>:

  /bin/bash /usr/sbin/virtualmin create-domain --parent "$parent_domain" --domain "$subdomain" --virtualmin-nginx --field-CustomerNo "12345" --field-CustomerEmail "customer@123example.com"

But I wonder how to modify it in the right way?

Found it… my bad!

The internal Field-Name wasn’t with whitespace:

So it works as expected if you use the correct field names that you chose in the virtualmin settings. :stuck_out_tongue_winking_eye:

virtualmin modify-custom --domain "19f12d9345jf.test.shop" --set "CustomerNo 12345" --set "CustomerEmail customer@123example.com"

Custom field values in 19f12d9345jf.test.shop successfully updated

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.