On local system
Using your local package management caches a simple use of some shell scripting:
apt-cache dumpavail | grep ^Package | cut -d " " -f 2 | sort | uniq
This just lists package names, so it's not the same as using the Software Centre API, but it will list all package names you can use later to query the API with, I guess. This lists 38820 packages on my system. Be aware that it may contain non-Ubuntu repository backed packages, so not all of them might be available in the SC.
Note: on amd64
systems with Multiarch enabled apt-cache
will list many double ones, so that's why the uniq
tool is used.