Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Endoflife api/v1 #2080

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Endoflife api/v1 #2080

wants to merge 3 commits into from

Conversation

marcwrobel
Copy link
Member

@marcwrobel marcwrobel commented Dec 17, 2022

This is a major rework of the API that fixes a lots of issues, but introduces a lot of breaking changes. See https://github.com/endoflife-date/endoflife.date/blob/2062-expose-product-info-api/CHANGELOG_API.md for more information.

Note that I thought of disabling API generation in development (using JEKYLL_ENV like the Jekyll Feed plugin - see https://github.com/jekyll/jekyll-feed/blob/master/lib/jekyll-feed/generator.rb#L145), but I finally reverted it. It does not work well with Netlify preview, and generate production URL (i.e. https://endoflife.date/ URLs) in development which makes testing more difficult.

@marcwrobel marcwrobel linked an issue Dec 17, 2022 that may be closed by this pull request
@captn3m0
Copy link
Member

Few notes:

  • Want to use https://jekyllrb.com/docs/plugins/generators/ to better read our metadata
  • I want to update all our Product pages' metadata as they're read using a Jekyll hook to augment the data (set defaults, validate etc), and use this common data in all places (API, HTML etc). That way, the heavy lifting of standardization is only done once. Will file a PR for this soon.
  • Need to add redirects as well. We generate the netlify _redirects file, so hopefully a single redirect entry should work for this, but might need some tweaking.

@captn3m0
Copy link
Member

Wrote up a quick draft for the specification: endoflife-date/releases.json#1

@marcwrobel marcwrobel force-pushed the 2062-expose-product-info-api branch 3 times, most recently from 5e0f74c to f8e238b Compare December 17, 2022 16:13
@marcwrobel
Copy link
Member Author

I modified the plugin to use a generator. The script itself is much more simple, but the corresponding template will be a bit complex (like the product.html template). But it cannot be avoided if we want to achieve API / HTML parity without that.

@marcwrobel
Copy link
Member Author

  • Need to add redirects as well. We generate the netlify _redirects file, so hopefully a single redirect entry should work for this, but might need some tweaking.

Which redirects ? The redirects based on alternate_urls or the /api -> /api/v1 redirect ?

@captn3m0
Copy link
Member

The v1 redirects.

@marcwrobel
Copy link
Member Author

marcwrobel commented Dec 17, 2022

The v1 redirects.

Ok, that can wait if we decide to give time to migrate to client's maintainers.

@marcwrobel marcwrobel force-pushed the 2062-expose-product-info-api branch from f8e238b to a471521 Compare December 17, 2022 23:37
@marcwrobel
Copy link
Member Author

marcwrobel commented Dec 18, 2022

@captn3m0, what is your opinion about those subjects :

  1. API structure: should we move the /api/v1/<product>.json files the /api/v1/<product> directory. I think it makes more sense to have all the product resources at the same place. But we will have to rename the json file (for example to /api/v1/<product>/info.json).
  2. Response content: should all attributes be always present. For example if a product cycle does not have latest attribute (and releaseColumn: false), should we have "latest": null for the cycle or should we remove the latest attribute ? I don't know what is best, but I think always having those attribute is more explicit.

@marcwrobel marcwrobel force-pushed the 2062-expose-product-info-api branch from a471521 to 451c337 Compare December 18, 2022 21:10
@captn3m0 captn3m0 mentioned this pull request Dec 20, 2022
@marcwrobel marcwrobel force-pushed the 2062-expose-product-info-api branch 2 times, most recently from a301630 to aa324fd Compare December 20, 2022 14:12
@marcwrobel
Copy link
Member Author

@captn3m0
Copy link
Member

permalink -> html_url perhaps? (And should we change link -> url as well?)

Don't like using /info.json in the URL. We can maybe do /api/v1/products/:name.json instead, if we want to add an additional namespace (products in this case).

@marcwrobel
Copy link
Member Author

Don't like using /info.json in the URL. We can maybe do /api/v1/products/:name.json instead, if we want to add an additional namespace (products in this case).

By introducing the :name/info.json I tried to introduce a namespace in the API for the product, so I am not fan of /api/v1/products/<product>.json. Better to have /api/v1/<product>.json in this case. To bad we cannot respond to /<product>/ !

@marcwrobel
Copy link
Member Author

@captn3m0, another test, with a a new schema : https://deploy-preview-2080--endoflife-date.netlify.app/api/v1/android/info.json. Just toying a little bit, this is in no way a proposal. But let me know what you think of the ideas.

  • I grouped all the links together (and we can add more links later if we want).
  • I grouped all the latest version informations (so that later if its needed the schema could be reused - for instance for the list of all versions)
  • I rename "releases" to "cycles". The release term is sometime confusing: is a a version, a major.minor release, a release cycle... ?
  • I used name and label for both products and cycles (for consistency).
  • I rename the releaseDate to date (not sure I like this one - and I am sure you will not like it ;)).

I am also wondering about the eol / discontinued fields. They seem close and I wondered if having only the eol field. Will have to read again the spec you wrote ;).

@captn3m0
Copy link
Member

To bad we cannot respond to // !

Think we can, we have Netlify header support. It's hacky, but if we set permalinks for these files correctly, and set content-type headers (application/json) from Netlify _headers file, it should work.

@marcwrobel marcwrobel force-pushed the 2062-expose-product-info-api branch 6 times, most recently from 1e35540 to d6438df Compare December 22, 2022 13:59
@marcwrobel
Copy link
Member Author

marcwrobel commented Dec 22, 2022

Think we can, we have Netlify header support. It's hacky, but if we set permalinks for these files correctly, and set content-type headers (application/json) from Netlify _headers file, it should work.

Just tried in with /api/v1/all.json, works well : https://deploy-preview-2080--endoflife-date.netlify.app/api/v1/.

# Rewrite for /api/v1/
/api/v1/       /api/v1/index.json       200!

I tried to also redirect /api/v1/index.json to /api/v1/ but it did not work:

# Rewrite for /api/v1/
/api/v1/       /api/v1/index.json       200!
/api/v1/index.json       /api/v1/

@adriens
Copy link
Contributor

adriens commented Mar 18, 2024

🙏

@marcwrobel marcwrobel force-pushed the 2062-expose-product-info-api branch from 00d746a to 4d2ea74 Compare March 31, 2024 13:51
@adriens
Copy link
Contributor

adriens commented Mar 31, 2024

👏

@MartinPetkov
Copy link
Contributor

Would it be possible to update this branch to pick up some of the latest versions?

PS I also wholeheartedly support having this PR reviewed and merged @captn3m0 🙂

@marcwrobel marcwrobel force-pushed the 2062-expose-product-info-api branch from 4d2ea74 to 1d44f32 Compare June 23, 2024 12:09
@marcwrobel
Copy link
Member Author

Would it be possible to update this branch to pick up some of the latest versions?

Done. Note that some fields have been renamed following #4931, see 1d44f32. Let me know if you notice something wrong.

@TimBrown1611
Copy link

hi! was this API v1 deployed?

@marcwrobel marcwrobel force-pushed the 2062-expose-product-info-api branch from 2d329ea to e61e47f Compare September 1, 2024 14:12
@marcwrobel
Copy link
Member Author

hi! was this API v1 deployed?

Yes, the preview is deployed on https://deploy-preview-2080--endoflife-date.netlify.app/docs/api/v1/.

@TimBrown1611
Copy link

hi! was this API v1 deployed?

Yes, the preview is deployed on https://deploy-preview-2080--endoflife-date.netlify.app/docs/api/v1/.

Hi! Thanks,
When it will be officially deployed? it seems like a demo

@flo7000
Copy link
Contributor

flo7000 commented Sep 9, 2024

Hello all
any updates on the deploy date? I'm waiting for it because it's the dependency for my task (mentioned in #2108 (comment) )

@marcwrobel
Copy link
Member Author

None on my side. I am still waiting for some reviews (at least one from @captn3m0). I would like the payloads format and field names to be confirmed before merging this, because once it's released we won't be able to change it easily.

@marcwrobel marcwrobel force-pushed the 2062-expose-product-info-api branch from e61e47f to 4e54596 Compare September 15, 2024 07:28
@TimBrown1611
Copy link

@captn3m0 do you think it will be merged soon? this API call adds some information which can be very useful for other tools :)

@marcwrobel marcwrobel force-pushed the 2062-expose-product-info-api branch from 4e54596 to c45f548 Compare September 23, 2024 12:12
@MartinPetkov
Copy link
Contributor

MartinPetkov commented Oct 24, 2024

@marcwrobel Could you please rebase this branch and update the preview API when you have time?

@glauberferreiranees
Copy link

Is there a planned date to release the new version of API? A preview of Swagger is available?

This is a major rework of the API with a lot of breaking changes. See CHANGELOG_API.md for more information.

Note that we thought of disabling API generation in development (using JEKYLL_ENV like the Jekyll Feed plugin - see https://github.com/jekyll/jekyll-feed/blob/master/lib/jekyll-feed/generator.rb#L145), but it was finally reverted. It does not work well with Netlify preview, and generate production URL (i.e. https://endoflife.date URLs) in development which makes it difficult to use.
@marcwrobel marcwrobel force-pushed the 2062-expose-product-info-api branch from c45f548 to 956a069 Compare October 26, 2024 09:17
@marcwrobel
Copy link
Member Author

Could you please rebase this branch and update the preview API when you have time?

Done.

Is there a planned date to release the new version of API?

Nope, still waiting for some reviews.

A preview of Swagger is available?

Yes, through the preview URL : https://deploy-preview-2080--endoflife-date.netlify.app/docs/api/v1/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose product level information in the API