[Slackbuilds-users] SBo API

Dominik Drobek dominik.drobek at o2.pl
Mon May 30 19:48:50 UTC 2022


Hi Dimitris,

Nice work.

I played with the API for a while, and I have a few comments from API 
user perspective:

1. Fields which contain multiple entries (e.g. "files", "md5sum" or 
"download") could be JSON arrays instead of long strings where entries 
are separated by whitespace.

2. Instead of an empty string (e.g. in "requires" field) it might be 
better to return an empty array.

3. The magic value "UNSUPPORTED" in "download" or "download_x86_64" 
fields seems unnecessary. I think having an empty array would be 
sufficient for API user to notice that, or to test against it. The value 
could be a JSON null if we wanted to be really expressive.

4. Leading "./" in "location" field is not needed. But I think it would 
be better to have a "category" instead of "location". There already is a 
"name" in API response, and "location" is just "category/name".

5. "short_description" field can be renamed to just "description" (it's 
the only description present in API response).

6. If we ever have a package name conflict across categories, what would 
the API endpoint /api/packages/<package_name> return? We don't seem to 
have such problem now, but we could potentially have one or more name 
clashes in the future. Having an endpoint 
/api/packages/<category>/<package_name> would be future-proof.


Taking into account suggestions 1-5, current API result:

{
   "4397": {
     "download": "UNSUPPORTED",
     "download_x86_64": 
"https://www.slsknet.org/SoulseekQt/Linux/SoulseekQt-2018-1-30-64bit-appimage.tgz",
     "files": "README SoulseekQt.SlackBuild SoulseekQt.desktop 
SoulseekQt.info doinst.sh selinux-stub.c slack-desc",
     "location": "./network/SoulseekQt",
     "md5sum": "",
     "md5sum_x86_64": "1d98331893bc9b9d45ba34f6523353ab",
     "name": "SoulseekQt",
     "requires": "",
     "short_description": "SoulseekQt (Soulseek P2P network client)",
     "version": "20180130"
   }
}

would become:

{
   "4397": {
     "category": "network",
     "download": [],
     "download_x86_64": [
 
"https://www.slsknet.org/SoulseekQt/Linux/SoulseekQt-2018-1-30-64bit-appimage.tgz"
     ],
     "files": [
       "README",
       "SoulseekQt.SlackBuild",
       "SoulseekQt.desktop",
       "SoulseekQt.info",
       "doinst.sh",
       "selinux-stub.c",
       "slack-desc"
     ],
     "md5sum": [],
     "md5sum_x86_64": [
       "1d98331893bc9b9d45ba34f6523353ab"
     ],
     "name": "SoulseekQt",
     "requires": [],
     "short_description": "SoulseekQt (Soulseek P2P network client)",
     "version": "20180130"
   }
}


Regards,
Dominik


More information about the SlackBuilds-users mailing list