Skip to content

Add pagination support when fetching badge templates from the Credly API #2894

@luisfelipec95

Description

@luisfelipec95

Description

Currently, the fetch_badge_templates function retrieves only the first page of results (up to 50 templates) from the Credly API.
As a result, organizations with more than 50 badge templates do not have all their templates synchronized into the local database.

This enhancement proposes adding pagination support to ensure that all badge templates are fetched and synchronized correctly.

Proposal

Implement pagination support in the fetch_badge_templates function to ensure that all active badge templates are retrieved from the Credly API.

The updated implementation would:

  • Make an initial request to retrieve the first page of badge templates.
  • Read pagination metadata from the API response (total_pages and next_page_url).
  • Iterate through all remaining pages using the next_page_url field until all templates are fetched.
  • Aggregate all results into a single list and return them to the synchronization process.

This approach ensures that the synchronization process retrieves all active badge templates, even for organizations that exceed the 50-template limit imposed by a single-page response from Credly.

A pull request implementing this enhancement has been opened: #2895

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions