#10674 Package version via REST API
Closed: Upstream by kevin. Opened by yellowhat.

Hi,
I would to query the available versions (ideally just the latest) for
a specific package and fedora release via a REST API call (not dnf).

I can partly solve my question by using https://mdapi.fedoraproject.org.

Unfortunately, I have noticed that it is pulling also from the *-testing
repositories:

curl --silent "https://mdapi.fedoraproject.org/f35/pkg/vim-enhanced"
... "vim-minimal"], "repo": "updates-testing"}

Is there a way to restrict it only to the "official" one?

Thanks


Metadata Update from @phsmoura:
- Issue priority set to: Waiting on Assignee (was: Needs Review)
- Issue tagged with: low-gain, low-trouble, ops

It looks like mdapi doesn't have this ability. You could file a RFE on it at https://pagure.io/mdapi/

I do see that you can get this information sort of via:

https://packager-dashboard.fedoraproject.org/api/v1/package_versions/vim

that returns a json with 'stable' and 'updates' you could parse out with jq?

Not sure what else we can do for you here... but if you think of something, feel free to reopen or file a new ticket.

Metadata Update from @kevin:
- Issue untagged with: low-gain, low-trouble, ops
- Issue close_status updated to: Upstream
- Issue priority set to: Needs Review (was: Waiting on Assignee)
- Issue status updated to: Closed (was: Open)

Thank you very much for your reply.
Unfortunately I am getting a bit of inconsistent results:

$ curl --silent "https://packager-dashboard.fedoraproject.org/api/v1/package_versions/vim" | jq -r '."Fedora 35".stable'
vim-8.2.4845-1.fc35
$ curl --silent "https://packager-dashboard.fedoraproject.org/api/v1/package_versions/python-pip" | jq -r '."Fedora 35".stable'
python-pip-21.2.3-4.fc35
$ podman run -it --rm fedora:35 dnf install vim-8.2.4845-1.fc35 python-pip-21.2.3-4.fc35 
...
No match for argument: vim-8.2.4845-1.fc35
No match for argument: python-pip-21.2.3-4.fc35
Error: Unable to find a match: vim-8.2.4845-1.fc35 python-pip-21.2.3-4.fc35
$ podman run -it --rm fedora:35 dnf install vim-8.2.4845-1 python-pip-21.2.3-4     
...
No match for argument: vim-8.2.4845-1
No match for argument: python-pip-21.2.3-4
Error: Unable to find a match: vim-8.2.4845-1 python-pip-21.2.3-4
$ podman run -it --rm fedora:35 dnf install vim-8.2.4845 python-pip-21.2.3   
...
Last metadata expiration check: 0:00:01 ago on Thu May  5 19:02:00 2022.
No match for argument: vim-8.2.4845
No match for argument: python-pip-21.2.3
Error: Unable to find a match: vim-8.2.4845 python-pip-21.2.3
$ podman run -it --rm fedora:35 dnf install vim-enhanced-8.2.4845 python3-pip-21.2.3   
...
Works!!!

Is this the intended behaviour?

Metadata Update from @yellowhat:
- Issue status updated to: Open (was: Closed)

This is not intended, but container updates composes have been failing recently (due to https://bugzilla.redhat.com/show_bug.cgi?id=2077680 )

As soon as those start flowing everything should be back to normal... (and f36/f37 containers are working so should already have the updated version)

Metadata Update from @kevin:
- Issue close_status updated to: Upstream
- Issue status updated to: Closed (was: Open)

Metadata