Files
edx-platform/openedx/core/djangoapps/user_api
Deborah Kaplan 3dc96a97e9 feat: allows a reversion of the retirement partner report reset toggle (#37539)
* feat: allows a reversion of the  retirement partner report reset toggle

This allows you to set retirement partner report statuses to True as well as to False. One sample use case: if an overly large number of retirement partner reports have their status reset to false, the partner report queue can struggle to deal with the large queue.

FIXES: APER-4177
2025-10-24 17:07:40 +00:00
..
2024-08-22 14:56:51 -04:00

Status: Active

Responsibilities
================
The user_api app is currently a catch all that is used to provide various apis that are related to the user and also to features within the platform.

Intended responsibility: To manage user profile and general account information and to provide APIs to do so easily. This includes the following features: user preference, user profile, user retirement, and account activation/deactivation.

Direction: Decompose
====================
Currently this app is a catch all for many user related information even when that information should really belong in a different app.  If you are building a feature and need to provide information about a user within the context of your feature, you should localize that API to your feature and make your assumptions about what user information you need clear.

For example authentication related APIs have already been moved to the user_authn django app.

Glossary
========

More Documentation
==================

Persisting Optional User Metadata
*********************************
The User API is capable of storing optional learner metadata through the use of a feature called the **Extended Profile**. The **Extended Profile** is a lightweight option for storing optional user data that doesn't require the modification or update of existing Django models.

This data is persisted as part of the ``meta`` field of a learner's UserProfile instance.

Storing data requires a *PATCH* request to be made to the User API endpoint.

This request data must include a key named **extended_profile** that contains a list of dictionaries representing the additional data we wish to store for the learners. Each dictionary in the list must include two fields:

* ``field_name``: A name describing the data to be stored
* ``field_value``: The data to be stored

An example request using *curl*, storing information in a field named ``occupation``:

.. code-block:: bash

    curl --request PATCH '{{lms_host}}/api/user/v1/accounts/{{lms_username}}' \
    -- header 'Authorization: JWT {{jwt_token}}' \
    -- header 'Content-Type: application/merge-patch+json' \
    -- data '{
        "extended_profile": [
            {
                "field_name:" "occupation",
                "field_value": {
                    "name": "Organic Farmer",
                    "salary": "65000"
                }
            }
        ]
    }'

It is important to note that this data will not be returned as part of the User API until the system's Site Configuration has been updated. Details on how to update the Site Configuration can be found at `Retrieving Extended Profile Metadata`_.

.. _Retrieving Extended Profile Metadata: https://docs.openedx.org/en/latest/site_ops/install_configure_run_guide/configuration/retrieve_extended_profile_metadata.html