API, SQL, anyway to get data in or out?

Hey!

I’m an old-time DevonThink 2.x Pro user from a decade ago.

Since then I’ve become a backend developer, and I’m interested in mixing REST API work with something like DT3.

I have a service that I collect tagged files from, and I’d like to put them into DT, and have them properly tagged for coalition, and sync them in the cloud so I have quick access from my phone. I could do this in the Finder and iCloud, but I don’t want to trash my taggings across all my iCloud computers.

DT3 seems like it might solve a lot of problems easily. But to be honest, I kinda hate AppleScript.

Is there anything like a query language, or an API to DT for uploading or editing content/tags in the database?

Or am I barking up the wrong tree, and should I just commit the time to something like a custom SQLite solution?

As far as I know: no. Also found this post from 2019

So it seems AppleScript (or JavaScript) are the only options.

Importing or indexing stuff into DEVONthink via AppleScript isn‘t hard, however I‘ve no idea how you get your stuff and from where. Could you explain your setup a little?

1 Like

Difficult so say after that description. As @pete31 pointed out, you can script DT with JavaScript and AppleScript. Those are in most cases equally well suited (smart rules with external scripts being a notable exception).
So yes, you can use JS/AS for

For example, I use JS in Hazel to sort incoming documents into the appropriate groups in DT.

However, this is not at all in the ballpark of a REST API. DT is usually not running as a server unless you have the special server edition. Even in this case, I doubt that it would provide a REST API. The JS/AS APIs mentioned before do not require DT to be running, they can start it if necessary (as opposed to a REST API). On the other hand, they are strictly limited to the current machine – there’s not protocol to talk to a DT instance on another machine (which again would require DT to be running as a server, i.e. listening on some port etc.).

That would not give you any advantage over DT, I’d say. SQLite is also limited to the current machine (no server capabilities), SQL is a beast (even more so then AppleScript ;-), and in my opinion DT is much easier to use.

afaik The only tool is scripting - Applescript works great for me

1 Like

I would be interested in a SQLite solution.

I’d like to (bi-directional) sync certain groups to my CMS/website and using SQlite seems to be the best way to do that?

Haven’t found anything on the forums so far related to SQLlite export or bi-directional syncing a group to a website.

1 Like

I appreciate the attention, I think I have the answer to my curiosities.

Good point. I was considering -maybe- upgrading from my 2.x to a 3.x server license if that wasn’t the case.

I think SQL is just fine:

MariaDB is really cool, and seems to be remarkably fast on millions of records (provided the right columns are indexed). Plus, I have an obsession for execution time in my scripts, so I don’t mind hand crafting a temp table in order to left join results faster server-side than in code.


To be honest, I’m emotionally done with AS, and I have no intention in learning the “JS” implementation for OSA.

I think I’m looking for the solution with the wrong tool.

Thanks for the replies, everyone!

For relational data, sure. For anything else? And this anything else is what you’d usually put into DEVONthink. Querying blobs with SQL might be feasible, but it’s certainly not what it was intended for.

1 Like