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

Change certified API to use the v2 API endpoints #13827

Merged

Conversation

andrejvelichkovski
Copy link
Contributor

@andrejvelichkovski andrejvelichkovski commented Apr 30, 2024

Done

  • [List of work items including drive-bys - remember to add the why and what of this work.]

This change updates the certified component to use the new public v2 API our team has already created, instead of the old v1 API. For the v2 API we are using a new REST API framework, which allows us to make the new endpoints significantly more flexible and modular. After finishing all migrations from the old v1 API and ensuring no external users make use of them, we will start with the deprecation of these endpoints.

API client change

As part of this change, we are also slightly modifying the terminology used in the API endpoints. Namely, we are starting to deprecate the use of the model keyword in the endpoints, replacing it with configuration which is what the Certification team currently uses in the business works. Similarly, the make keyword is replaced with the vendor keyword, as this is what reflects the data represented in this field. To minimize the effect of the migration of the API endpoints, we tried to keep the endpoints as backwards-compatible as possible and decided to not change the response structure.

The following seven APIs have been updated and replaces with v2:

v1 API endpoint v2 API endpoint
/api/v1/certifiedmodels /api/v2/certified-configurations
/api/v1/certifiedmodeldetails /api/v2/certified-configuration-details
/api/v1/certifiedmodeldevices /api/v2/certified-configuration-devices
/api/v1/certifiedreleases /api/v2/certified-releases
/api/v1/certifiedmakes /api/v2/certified-vendors
/api/v1/componentsummaries /api/v2/component-summaries
/api/v1/componentsummaries/ID /api/v2/component-summaries/ID

Backend views change

Some of the views are slightly modified to reflect for the new response structure of the APIs. Few common changes appearing in the views:

  • the total count of objects in the response are now stored under the count field, instead of meta.total_count field in the v1 API
  • the list of objects in the response are now stored in the results field, instead of the objects in the v1 API
  • the v2 API is paginated using page-numbers by default, but we have provided limit-offset pagination on top of this, which can be specified with the pagination=limitoffset query parameter, which is put in use in the api client.

QA

Issue / Card

This change fixes C3-614

Screenshots

The design of the website hasn't changed.

Help

QA steps - Commit guidelines

@webteam-app
Copy link

webteam-app commented Apr 30, 2024

andrejvelichkovski is not a collaborator of the repo

Demo: https://ubuntu-com-13827.demos.haus/

@andrejvelichkovski andrejvelichkovski marked this pull request as ready for review May 7, 2024 10:42
@@ -362,6 +362,7 @@ def get_filters(request_args=None, json: bool = False):
release_filters.extend(all_releases)

if json:
print("TESTING JSON")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this line? is it necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this! I have now updated the code to remove this line.

@carkod carkod merged commit 23b9b46 into canonical:main May 20, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants