Skip to content

Changes to V2

jgregoriBb edited this page Nov 20, 2022 · 2 revisions

Changes to V2

The library continues to evolve with refinements and new use cases. As a personal project, the Bb Rest Helper did not came with much documentation about changes and versions, however, it is also true that changes util this version have been mostly compatible with previous versions (incremental enhancements and fixes) and the history can be checked in the Github repository

This version, however, brings some breaking changes, so make sure to review this information before updating;

1.GET requests support for api pagination for the sake of simplicity, GET requests for the learn API via the Bb_GET method will now return results from ALL pages, while this makes the method heavier to run, it is possible to control the amount of results via parameters (either using query parameters to filter results or directly using the limit). Collaborate GET requests will continue to work as before.

2.Changes to url/endpoints until now, some manipulation was required to pass the full endpoint to the Bb_Request calls. In this version, a decision was made to split the base_url and endpoint as separate arguments for the methods. While this involves some refactoring for stuff created with previous versions, it enhances the overall workflows and allowed to build better support for other features such as pagination.

#V.1.X.X
req = Bb_Requests()
base_url = 'your server url'
endpoint = 'API endpoint'
request_url = f'{base_url}{endpoint}'
request = req.Bb_GET(request_url, token, params)
#V.2.X.X
req = Bb_Requests()
base_url = 'your server url'
endpoint = 'API endpoint'
request = req.Bb_GET(base_url,endpoint,token, params)

3.Quick authentication method for Learn and Collaborate has been included in the Bb_Utils class, it uses the Get_Config and Auth_Helper classes under the hood to provide a convenient one liner that returns the token and the base_url.

utils = Bb_Utils()
quick_auth_learn = utils.quick_auth('./learn_config.json','Learn')
quick_auth_collab = utils.quick_auth('./collab_config.json','Collaborate')
#With this method you have access to the token and the url for each platform
#So it will not be neccesary to hardcode the url or call Get_Config separately
learn_token = quick_auth_learn['token']
collab_token = quick_auth_collab['token']
learn_url = quick_auth_learn['url']
collab_url = quick_auth_collab['url']

4.Added rate limit information to logs on Bb_requests for Learn requests When performing a request to the learn API using Bb_requests, rate limit information covering API Limit, Remaining API calls and time to reset the API limit is included in the logs. This could not be implemented for Collaborate as it does not provide the same level of information in the response headers.

Clone this wiki locally