Widget API

This guide expects that you have read the Prerequisites.

Overview of displaying the widget and entering the subscription serviceOverview of displaying the widget and entering the subscription service

Overview of displaying the widget and entering the subscription service

The user should see the widget with monthly subscription cost and number of subscriptions at your given point in the application. The widget should load the data asynchronously and not block the rest of the application. At worst this should mean that the widget is displayed in its loading state for a short period of time. When the user clicks on the widget a WebUI URL has to be requested to show the correct view in the subscription manager.

Get monthly subscription cost and number of subscriptions

You should read the API documentation for Get Overview Contents. You should also check the following guidelines on how to utilize the endpoint for the widget use case.

  • Minna recommends that you only call this endpoint from your backend and not directly from your client.
  • Minna also recommends that you cache this response.
  • The endpoint gives you a summary of a user's subscriptions and you can derive the monthly subscription cost and number of subscriptions.

You can find the relevant parts of the response in the following table.

Field

Description

subscriptions

These are the current active subscriptions. You should check subscriptions.size or subscriptions.length to get the number of subscriptions for the widget.

cancelledSubscriptions

These are the cancelled subscriptions. You can ignore this field, since it is not related to the widget.

orderedSubscriptions

These are the ordered subscriptions. You can ignore this field, since it is not related to the widget.

totalCostPerInterval

These are the total cost per interval. You should extract only the monthly interval for the widget.

lastUpdate

This is the last date and time when the subscription data was updated. You can use this field to determine if you should update any overview data that you may have cached.

Fetch the WebUI URL

You can obtain the link to the WebUI by calling the WebUI endpoint.

If there is a detection process running, the user will be presented with a loading screen, and an updated list of subscriptions once the detection completes.

To display the webUI to the user, please refer to the Opening WebUI URLs guide.


Did this page help you?