Hangar icon indicating copy to clipboard operation
Hangar copied to clipboard

Change with the API endpoint for the latest version of a specific channel with a project

Open thecmdradama opened this issue 1 year ago • 3 comments

Is your feature request related to a problem?

Hi guys,

This feature request is to adjust the API endpoint for project channels.

Lets use ProtocolLib for our example. The current request URL to get the latest version number of a project in a specific channel is: https://hangar.papermc.io/api/v1/projects/dmulloy2/ProtocolLib/latest?channel=RC

Describe the solution you'd like.

What I would like to propose instead is to have the channel as a URL slug instead of a URL variable

The proposed request URL for ProtocolLib would look like: https://hangar.papermc.io/api/v1/projects/dmulloy2/ProtocolLib/channels/RC/latest

This would also open up the opportunity to get the full details of a specific version from a specific channel or download the fil i.e.

https://hangar.papermc.io/api/v1/projects/dmulloy2/ProtocolLib/channels/RC/versions/{name} https://hangar.papermc.io/api/v1/projects/dmulloy2/ProtocolLib/channels/RC/versions/{name}/download

Describe alternatives you've considered.

I can't think of any other clean way to do this so there isn't really any alternative

Other

No response

thecmdradama avatar Apr 23 '23 10:04 thecmdradama

Versions exist indepentendly of channels, so the last two examples you provide don't make much sense - Is there any other reason you want the channel not to be a query parameter?

kennytv avatar May 08 '23 17:05 kennytv

I guess the main purpose was to try and improve the readability of the URI by replacing the query parameter with a slug. Now I look at them more, those two examples don't make a great deal of sense in comparison to the existing version endpoints. The theory was to drill down from the channel to get the latest version, which now I see would have been backwards.

Something like these would make more sense https://hangar.papermc.io/api/v1/projects/{author}/{slug}/versions/latest/channel/{name}/{platform}/download https://hangar.papermc.io/api/v1/projects/{author}/{slug}/versions/latest/channel/{name}/stats

thecmdradama avatar May 09 '23 14:05 thecmdradama

what is the actual usecase you want to have? just adding new endpoints just because the urls look nicer doesnt make much sense to me

MiniDigger avatar May 04 '24 14:05 MiniDigger