Akonadi Help: How it works?

I’m not sure that I’m correctly wrapping my head around concept of the Akonadi server, but it seems to be a way to integrate industry standard flat file storage with a RDMS backend, to get everything talking to each-other. I see the value in that, but I have not been able to interact with those flat files and persist changes back into applications.

i.e Manually editing a kaddress card results in the data not populating in kaddress gui (this seems to be expected behavior).

I would like a way to interact with those files from the terminal, so that I can script CRUD changes through the akonadi server to the several application GUIs.

If a tool like this doesn’t exist, then someone who has the patience of an elementary teacher please explain how akonadi works with some examples. I’ve read the docs, and I’m not getting how to use the libraries without first invoking the gui.

Thanks in advance!

Akonadi uses storage connectors called “resources” to access data, locally and remotely.

Their capabilities can vary. Some can detect changes to the data themselves, others need to regularly check (the server asks them to update in regular intervals).

Maybe you are using an address book connector that does not check itself and has also not been configured for interval checking.

For scripting I could also suggest to have a look at akonadiclient

I’m developing on a fresh install of Manjaro KDE stable, with optional dependencies installed.

I’ve looked at akonadi-client, and it doesn’t appear to have the functionality that I’m interested in. As far as akonadi goes, the docs seem pretty sparse. What I searching for is something like this:

akonadi-cli-contacts add —name “contact name” —email “contact@email.com”

akonadi-cli-contacts list —names

I can build it, but I’d rather not reinvent the wheel.

Yes, akonadiclient does allow command line access to the data but doesn’t interpret it.

So for contact data it would output the vcard data or allow to add a vcard file as a new contact.

I’ve been using it in the past to add events to a calender, where another tool would generate the iCal files and akonadiclient would then add them to whatever calendar I wanted to them to appear in.

Theoretically I could have also appended the new data to an ical file monitored by a calendar file resource or created new files in a directory managed by a ical directory resource (and configuring it for interval checking), but I wanted the entries in a remote calendar.

I guess what you are looking for is a contact equivalent to konsolekalendar

Many years ago we had a tool called kabcclient which was essentially that but I think it never got ported :frowning:

Yes, something like konsolekalendar but for contacts would be great, so konsolekontacts? If there are any other KDE apps that have a similar API, please advise.

Is there documentation somewhere describing how to do what you’re doing with akonandiclient? I’m curious if that could be used to build a wrapper to tide me over?

I do have a follow up question, but I’ll break it out so keep the thread sanitized.

Is it possible, with little hassle, to use the akonadi-server in two or more stages? For instance, on local devices using qt version of SQLite, and then replicating the data to one of the specified SQL servers? Essentially, the same concept as an offline first mobile app, but on the LAN.

Thanks!

Yes, something like that.

Many years ago we had a tool called kabcclient that could be used as a command line interface to KAddressBook data but sadly it did never really get ported to Akonadi.

When you have it build it comes with --help output and a man page.
The source for the latter is here

Essentially you can use its list command to look at the data, e.g.

akonadiclient list /

will list all top level entries, e.g. addressbooks, calendars, email accounts.
The argument is essentially like a “path” into the data.

For example for me it would (among other things) display

/std.vcf

The name of my default addressbook.

The add command can be used to add data

akonadiclient add /std.vcf some-vcard-file.vcf

will add the contact specified in a local file called some-vcard-file.vcf to my default addressbook.

So if you have a tool or script that can generate a VCard file, akonadiclient will be able to add it.

1 Like

There is no built-in replication but you can of course copy the data like any other.
I regularly rsync my whole HOME directory between a desktop PC and a laptop, including the Akonadi setup.

If the devices are very different it might be better to put data on a server and access that on each device.

I’m marking this solved, because my questions have been answered; though with limited satisfaction.

The akonadiclient solution as described in this thread, can augment a command line workflow, but it is rather “hack-ish”.

I did review the 800ish lines of source for kabcclient, while not compatible, I do believe that it provides a decent starting point for a port or re-implementation, if nothing more than a template of desirable features.

@krake thank-you for your help.

It is currently working on the generic level so that it can be used across all data provided by Akonadi.

My primary use case at some point was to import a whole directory of calendar entries which is just a single call.

It could be extended with data type specific commands, e.g. an add-contact command with type specific data and options.

However a type specific tool might be able to do this in a better or more convenient way.

Since I have extensively worked on both tools (but many years ago) I would probably go for a clean implementation.

There is likely a lot of the console side input/output handling in kabcclient that can be reused but the storage side is quite different and likely more along the lines of akonadiclient.

I.e. like kabcclient the new tool would create an Addressee object and then use an ItemCreateJob like akonadiclient to add it to an addressbook.