lms.djangoapps.mobile_api.notifications package#

Submodules#

lms.djangoapps.mobile_api.notifications.urls module#

URLs for the mobile_api.notifications APIs.

lms.djangoapps.mobile_api.notifications.views module#

This module contains the view for registering a device for push notifications.

class lms.djangoapps.mobile_api.notifications.views.GCMDeviceViewSet(**kwargs)#

Bases: GCMDeviceViewSet

Use Case

This endpoint allows clients to register a device for push notifications.

If the device is already registered, the existing registration will be updated. If setting PUSH_NOTIFICATIONS_SETTINGS is not configured, the endpoint will return a 501 error.

Example Request

POST /api/mobile/{version}/notifications/create-token/ POST Parameters

The body of the POST request can include the following parameters. * name (optional) - A name of the device. * registration_id (required) - The device token of the device. * device_id (optional) - ANDROID_ID / TelephonyManager.getDeviceId() (always as hex) * active (optional) - Whether the device is active, default is True.

If False, the device will not receive notifications.

  • cloud_message_type (required) - You should choose FCM or GCM. Currently, only FCM is supported.

  • application_id (optional) - Opaque application identity, should be filled in for multiple key/certificate access. Should be equal settings.FCM_APP_NAME.

Example Response

```json {

“id”: 1, “name”: “My Device”, “registration_id”: “fj3j4”, “device_id”: 1234, “active”: true, “date_created”: “2024-04-18T07:39:37.132787Z”, “cloud_message_type”: “FCM”, “application_id”: “my_app_id”

authentication_classes = (<class 'edx_rest_framework_extensions.auth.jwt.authentication.JwtAuthentication'>, <class 'openedx.core.lib.api.authentication.BearerAuthenticationAllowInactiveUser'>, <class 'edx_rest_framework_extensions.auth.session.authentication.SessionAuthenticationAllowInactiveUser'>)#
basename = None#
create(request, *args, **kwargs)#
description = None#
detail = None#
name = None#
permission_classes = (<class 'rest_framework.permissions.IsAuthenticated'>,)#
suffix = None#

Module contents#