I would like to now what type of output f-droid server provides.
I’ve read somewhere that they also send json but I can’t find it anymore.
Also I would like to know if it is possible to format the output, add your own fields etc.
Is this possible and if so, where can I change this?
Yes, I’ve been there, but it wasn’t very clear to me where to find the information I needed.
But I’ve found it eventually.
No, I found it by debugging the client app which receives the data in json format.
Also this post might be the one I needed, but I’m still not sure if the metadata files determine what I receive:
I’m still not sure if the metadata files determine what I receive
No and yes.
Metadata determines how apps are build, nothing more.
Can you tell me how I can make sure the server will send the data in json format?
The index-v1.jar file is a signed JAR file containing only index-v1.json. That’s the JSON index. E.g. https://f-droid.org/repo/index-v1.jar
And is there somewhere a documentation on the format/structure used there, or does one need to reverse-engineer it? For example:
- it’s a JSON (obviously) object with the properties
packages (that all?)
repo is an object with the properties … (well, this part is easy to reverse engineer)
apps is an array of apps, each item having the properties … and here it’s getting a bit difficult, as some of those properties are optional (e.g.
localized and what might be in there)
requests is an object holding the arrays
uninstall (apps suggested by the repo to be automatically installed/uninstalled) – but how do those arrays look like when filled? A guess would be it’s just package names.
packages are the available
.apk files with their properties. Again, some of them seem to be optional (e.g. the
uses-permission array is completely missing (not empty, missing) if an app doesn’t request any permission)
So this bullet-pointed list is just a very incomplete “quick glance”. I’m missing a complete reference (yes, I searched already, which is why I landed here). This reference would be of primary interest for folks building their own clients (like the WebIf of my repo, which currently is still based on the XML index). I’d say there must be a reference somewhere, or did you tackle the client (and website) blindly?
As much as possible, the index JSON data tries to be as close as possible to the YAML build metadata files: https://f-droid.org/docs/Build_Metadata_Reference/
So apps is the list of all the app metadata from those files, and the packages metadata is derived from the Builds section.
Thanks, Hans, I’ll try to figure it out as soon as time permits – and maybe write up a little doc-page then.
@Izzy There’s https://gitlab.com/Matrixcoffee/twif-util which works with repo index files. It’s not documentation as such, but there’s code, and there are at least two half linters in there, which unfortunately don’t make a whole linter together quite yet. It’s the result of all my research and questions up until now though, and as such may contain useful information.
Thanks @Coffee – good to know! Will crosscheck one I start updating my current XML-based library to also support the JSON format!
About writing a doc, I think it makes more sense to just document the differences in Build_Metadata_Reference, then there is less to maintain. Most of the fields are the same between metadata files and index-v1.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.