GLib's `gdbus introspect` can show you the parameter names if they're included in the introspection XML:
gdbus introspect -y -d org.freedesktop.systemd1 -o /org/freedesktop/systemd1/unit/cups_2eservice But introspection is mainly for use by language bindings (e.g. perl-dbus) – it is not a substitute for documentation. For anything beyond that, systemd has manual pages for each bus service it implements, e.g.: man org.freedesktop.systemd1 https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.systemd1.html On Tue, Jun 17, 2025, 06:33 Chris Kottaridis <ch...@quietwind.net> wrote: > I am beginning to use the sd-bus library. I have been able to get a couple of > properties, MainPID and SubState. > > I would like to use the Stop method. I am using cups as an example. This > commands shows that in thee Unit interface there is a Start and Stop method: > > $ busctl introspect org.freedesktop.systemd1 > /org/freedesktop/systemd1/unit/cups_2eservice > > NAME TYPE SIGNATURE RESULT/VALUE FLAGS > > org.freedesktop.systemd1.Unit interface - - > - > > .Start method s o > - > .Stop method s o > - > > Each has a signature of "s" I assume it takes one parameter of type string. > > I have tried the sample on this page. Pasting it into a file and compiling > and running it works > great. > > https://0pointer.net/blog/the-new-sd-bus-api-of-systemd.html > > This sample starts the cups service by acccessing the systemd Manager and > calling StartUnit. > > /* Issue the method call and store the respons message in m */ > r = sd_bus_call_method(bus, > "org.freedesktop.systemd1", /* service to contact */ > "/org/freedesktop/systemd1", /* object path */ > "org.freedesktop.systemd1.Manager", /* interface > name */ "StartUnit", > /* method name */ &error, > /* object to return error in */ &m, > /* return message on success */ > "ss", /* input signature */ > "cups.service", /* first > argument */ "replace"); > /* second argument */ > > It has a signature of "ss" which I assume means the method takes 2 arguments > each of a type string. > > My question is for any given method how do I get what the arguments for it > are ? > > Like if I use Start what are valid values to pass for the one argument? > > In StartUnit the first argument seems obvious with an example to be the unit > you want to start. I > am not sure what the "replace" means or what other strings would be valid. > > Again I am interested in the Stop method specifically, but in general would > like to know where I can > get a list of the arguments and possible values for any method. > > Thanks > Chris > >