Al-Farabi Kazakh National University user API

The user API from Al-Farabi Kazakh National University — 38 operation(s) for user.

OpenAPI Specification

al-farabi-kazakh-national-university-user-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Open edX agreements user API
  description: APIs for access to Open edX information
  contact:
    email: dl@kaznu.kz
  version: v1
servers:
- url: https://open.kaznu.kz/api
security:
- Basic: []
tags:
- name: user
paths:
  /user/v1/account/password_reset/:
    get:
      operationId: user_v1_account_password_reset_list
      description: HTTP end-point for GETting a description of the password reset form.
      tags:
      - user
      responses:
        '200':
          description: ''
  /user/v1/account/password_reset/token/validate/:
    post:
      operationId: user_v1_account_password_reset_token_validate_create
      description: HTTP end-point to validate password reset token.
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/account/registration/:
    get:
      operationId: user_v1_account_registration_list
      description: HTTP end-points for creating a new user.
      tags:
      - user
      responses:
        '200':
          description: ''
    post:
      operationId: user_v1_account_registration_create
      summary: Create the user's account.
      description: 'You must send all required form fields with the request.


        You can optionally send a "course_id" param to indicate in analytics

        events that the user registered while enrolling in a particular course.'
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/accounts:
    get:
      operationId: user_v1_accounts_list
      description: 'GET /api/user/v1/accounts?username={username1,username2}

        GET /api/user/v1/accounts?email={user_email} (Staff Only)

        GET /api/user/v1/accounts?lms_user_id={lms_user_id} (Staff Only)'
      tags:
      - user
      responses:
        '200':
          description: ''
  /user/v1/accounts/cancel_retirement/:
    post:
      operationId: user_v1_accounts_cancel_retirement
      summary: POST /api/user/v1/accounts/cancel_retirement/
      description: 'Cancels the retirement for a user''s account.

        This also handles the top level error handling, and permissions.'
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/accounts/deactivate_logout/:
    post:
      operationId: user_v1_accounts_deactivate_logout_create
      summary: POST /api/user/v1/accounts/deactivate_logout/
      description: 'Marks the user as having no password set for deactivation purposes,

        and logs the user out.'
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/accounts/name_change/:
    post:
      operationId: user_v1_accounts_name_change_create
      summary: POST /api/user/v1/accounts/name_change/
      description: "Request a profile name change. This creates a PendingNameChange to be verified later,\nrather than updating the user's profile name directly.\n\nExample request:\n    {\n        \"name\": \"Jon Doe\"\n    }"
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/accounts/name_change/{username}/confirm/:
    post:
      operationId: user_v1_accounts_name_change_confirm
      summary: POST /api/user/v1/account/name_change/{username}/confirm
      description: Confirm a name change request for the specified user, and update their profile name.
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      responses:
        '201':
          description: ''
  /user/v1/accounts/replace_usernames/:
    post:
      operationId: user_v1_accounts_replace_usernames_create
      description: "POST /api/user/v1/accounts/replace_usernames/\n```\n{\n    \"username_mappings\": [\n        {\"current_username_1\": \"desired_username_1\"},\n        {\"current_username_2\": \"desired_username_2\"}\n    ]\n}\n```\n\n**POST Parameters**\n\nA POST request must include the following parameter.\n\n* username_mappings: Required. A list of objects that map the current username (key)\n  to the desired username (value)\n\n**POST Response Values**\n\nAs long as data validation passes, the request will return a 200 with a new mapping\nof old usernames (key) to new username (value)\n\n```\n{\n    \"successful_replacements\": [\n        {\"old_username_1\": \"new_username_1\"}\n    ],\n    \"failed_replacements\": [\n        {\"old_username_2\": \"new_username_2\"}\n    ]\n}\n```"
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/accounts/retire/:
    post:
      operationId: user_v1_accounts_post
      summary: POST /api/user/v1/accounts/retire/
      description: "```\n{\n    'username': 'user_to_retire'\n}\n```\n\nRetires the user with the given username.  This includes retiring this username, the associated email address,\nand any other PII associated with this user."
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/accounts/retire_misc/:
    post:
      operationId: user_v1_accounts_post
      summary: POST /api/user/v1/accounts/retire_misc/
      description: "```\n{\n    'username': 'user_to_retire'\n}\n```\n\nRetires the user with the given username in the LMS."
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/accounts/retirement_cleanup/:
    post:
      operationId: user_v1_accounts_cleanup
      summary: POST /api/user/v1/accounts/retirement_cleanup/
      description: "```\n{\n    'usernames': ['user1', 'user2', ...]\n}\n```\n\nDeletes a batch of retirement requests by username."
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/accounts/retirement_partner_report/:
    post:
      operationId: user_v1_accounts_retirement_partner_report_create
      summary: POST /api/user/v1/accounts/retirement_partner_report/
      description: 'Returns the list of UserRetirementPartnerReportingStatus users

        that are not already being processed and updates their status

        to indicate they are currently being processed.'
      tags:
      - user
      responses:
        '201':
          description: ''
    put:
      operationId: user_v1_accounts_retirement_partner_report_update
      summary: PUT /api/user/v1/accounts/retirement_partner_report/
      description: "```\n{\n    'username': 'user_to_retire'\n}\n```\n\nCreates a UserRetirementPartnerReportingStatus object for the given user\nas part of the retirement pipeline."
      tags:
      - user
      responses:
        '200':
          description: ''
  /user/v1/accounts/retirement_partner_report_cleanup/:
    post:
      operationId: user_v1_accounts_retirement_partner_cleanup
      summary: POST /api/user/v1/accounts/retirement_partner_report_cleanup/
      description: '[{''original_username'': ''user1''}, {''original_username'': ''user2''}, ...]


        Deletes UserRetirementPartnerReportingStatus objects for a list of users

        that have been reported on.'
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/accounts/retirement_queue/:
    get:
      operationId: user_v1_accounts_retirement_queue
      summary: 'GET /api/user/v1/accounts/retirement_queue/

        {''cool_off_days'': 7, ''states'': [''PENDING'', ''COMPLETE''], ''limit'': 500}'
      description: 'Returns the list of RetirementStatus users in the given states that were

        created in the retirement queue at least `cool_off_days` ago.'
      tags:
      - user
      responses:
        '200':
          description: ''
  /user/v1/accounts/retirements_by_status_and_date/:
    get:
      operationId: user_v1_accounts_retirements_by_status_and_date
      summary: 'GET /api/user/v1/accounts/retirements_by_status_and_date/

        ?start_date=2018-09-05&end_date=2018-09-07&state=COMPLETE'
      description: 'Returns a list of UserRetirementStatusSerializer serialized

        RetirementStatus rows in the given state that were created in the

        retirement queue between the dates given. Date range is inclusive,

        so to get one day you would set both dates to that day.'
      tags:
      - user
      responses:
        '200':
          description: ''
  /user/v1/accounts/search_emails:
    post:
      operationId: user_v1_accounts_search_emails
      description: "POST /api/user/v1/accounts/search_emails\nContent Type: \"application/json\"\n{\n    \"emails\": [\"edx@example.com\", \"staff@example.com\"]\n}"
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/accounts/update_retirement_status/:
    patch:
      operationId: user_v1_accounts_update_retirement_status_partial_update
      summary: PATCH /api/user/v1/accounts/update_retirement_status/
      description: "```\n{\n    'username': 'user_to_retire',\n    'new_state': 'LOCKING_COMPLETE',\n    'response': 'User account locked and logged out.'\n}\n```\n\nUpdates the RetirementStatus row for the given user to the new\nstatus, and append any messages to the message log.\n\nNote that this implementation DOES NOT use the \"merge patch\" implementation seen in AccountViewSet.\nThe content type for this request is 'application/json'."
      tags:
      - user
      responses:
        '200':
          description: ''
  /user/v1/accounts/{username}:
    get:
      operationId: user_v1_accounts_read
      description: GET /api/user/v1/accounts/{username}/
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
    patch:
      operationId: user_v1_accounts_partial_update
      summary: PATCH /api/user/v1/accounts/{username}/
      description: Note that this implementation is the "merge patch" implementation proposed in
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
  /user/v1/accounts/{username}/deactivate/:
    post:
      operationId: user_v1_accounts_deactivate_create
      summary: POST /api/user/v1/accounts/{username}/deactivate/
      description: Marks the user as having no password set for deactivation purposes.
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      responses:
        '201':
          description: ''
  /user/v1/accounts/{username}/image:
    post:
      operationId: user_v1_accounts_image_create
      description: POST /api/user/v1/accounts/{username}/image
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      responses:
        '201':
          description: ''
    delete:
      operationId: user_v1_accounts_image_delete
      description: DELETE /api/user/v1/accounts/{username}/image
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      responses:
        '204':
          description: ''
  /user/v1/accounts/{username}/retirement_status/:
    get:
      operationId: user_v1_accounts_retirement_status_read
      description: 'GET /api/user/v1/accounts/{username}/retirement_status/

        Returns the RetirementStatus of a given user, or 404 if that row

        doesn''t exist.'
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
  /user/v1/accounts/{username}/verification_status/:
    get:
      operationId: user_v1_accounts_verification_status_list
      description: IDVerification Status endpoint
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
  /user/v1/accounts/{username}/verifications/:
    get:
      operationId: user_v1_accounts_verifications_list
      description: IDVerificationStatusDeetails endpoint to retrieve more details about ID Verification status
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/IDVerificationDetails'
  /user/v1/forum_roles/{name}/users/:
    get:
      operationId: user_v1_forum_roles_users_list
      description: Forum roles are represented by a list of user dicts
      tags:
      - user
      parameters:
      - name: name
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: A page number within the paginated result set.
        schema:
          type: integer
      - name: page_size
        in: query
        required: false
        description: Number of results to return per page.
        schema:
          type: integer
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                required:
                - count
                - results
                type: object
                properties:
                  count:
                    type: integer
                  next:
                    type: string
                    format: uri
                    nullable: true
                  previous:
                    type: string
                    format: uri
                    nullable: true
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/user_api.User'
  /user/v1/me:
    get:
      operationId: user_v1_get
      description: GET /api/user/v1/me
      tags:
      - user
      responses:
        '200':
          description: ''
  /user/v1/preferences/email_opt_in/:
    post:
      operationId: user_v1_preferences_email_opt_in_create
      summary: Post function for updating the email opt in preference.
      description: 'Allows the modification or creation of the email opt in preference at an

        organizational level.'
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v1/preferences/time_zones/:
    get:
      operationId: user_v1_preferences_time_zones_list
      summary: '**Use Cases**'
      description: "Retrieves a list of all time zones, by default, or common time zones for country, if given\n\n    The country is passed in as its ISO 3166-1 Alpha-2 country code as an\n    optional 'country_code' argument. The country code is also case-insensitive.\n\n**Example Requests**\n\n    GET /api/user/v1/preferences/time_zones/\n\n    GET /api/user/v1/preferences/time_zones/?country_code=FR\n\n**Example GET Response**\n\n    If the request is successful, an HTTP 200 \"OK\" response is returned along with a\n    list of time zone dictionaries for all time zones or just for time zones commonly\n    used in a country, if given.\n\n    Each time zone dictionary contains the following values.\n\n        * time_zone: The name of the time zone.\n        * description: The display version of the time zone"
      tags:
      - user
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CountryTimeZone'
  /user/v1/preferences/{pref_key}/users/:
    get:
      operationId: user_v1_preferences_users_list
      description: DRF class for listing a user's preferences
      tags:
      - user
      parameters:
      - name: pref_key
        in: path
        required: true
        schema:
          type: string
      - name: page
        in: query
        required: false
        description: A page number within the paginated result set.
        schema:
          type: integer
      - name: page_size
        in: query
        required: false
        description: Number of results to return per page.
        schema:
          type: integer
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                required:
                - count
                - results
                type: object
                properties:
                  count:
                    type: integer
                  next:
                    type: string
                    format: uri
                    nullable: true
                  previous:
                    type: string
                    format: uri
                    nullable: true
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/user_api.User'
  /user/v1/preferences/{username}:
    get:
      operationId: user_v1_preferences_read
      description: GET /api/user/v1/preferences/{username}/
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
    patch:
      operationId: user_v1_preferences_partial_update
      description: PATCH /api/user/v1/preferences/{username}/
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
  /user/v1/preferences/{username}/{preference_key}:
    get:
      operationId: user_v1_preferences_read
      description: GET /api/user/v1/preferences/{username}/{preference_key}
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      - name: preference_key
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
    put:
      operationId: user_v1_preferences_update
      description: PUT /api/user/v1/preferences/{username}/{preference_key}
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      - name: preference_key
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
    delete:
      operationId: user_v1_preferences_delete
      description: DELETE /api/user/v1/preferences/{username}/{preference_key}
      tags:
      - user
      parameters:
      - name: username
        in: path
        required: true
        schema:
          type: string
      - name: preference_key
        in: path
        required: true
        schema:
          type: string
      responses:
        '204':
          description: ''
  /user/v1/user_prefs/:
    get:
      operationId: user_v1_user_prefs_list
      description: DRF class for interacting with the UserPreference ORM
      tags:
      - user
      parameters:
      - name: page
        in: query
        required: false
        description: A page number within the paginated result set.
        schema:
          type: integer
      - name: page_size
        in: query
        required: false
        description: Number of results to return per page.
        schema:
          type: integer
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                required:
                - count
                - results
                type: object
                properties:
                  count:
                    type: integer
                  next:
                    type: string
                    format: uri
                    nullable: true
                  previous:
                    type: string
                    format: uri
                    nullable: true
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/UserPreference'
  /user/v1/user_prefs/{id}/:
    get:
      operationId: user_v1_user_prefs_read
      description: DRF class for interacting with the UserPreference ORM
      tags:
      - user
      parameters:
      - name: id
        in: path
        required: true
        description: A unique integer value identifying this user preference.
        schema:
          type: integer
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserPreference'
  /user/v1/users/:
    get:
      operationId: user_v1_users_list
      description: DRF class for interacting with the User ORM object
      tags:
      - user
      parameters:
      - name: page
        in: query
        required: false
        description: A page number within the paginated result set.
        schema:
          type: integer
      - name: page_size
        in: query
        required: false
        description: Number of results to return per page.
        schema:
          type: integer
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                required:
                - count
                - results
                type: object
                properties:
                  count:
                    type: integer
                  next:
                    type: string
                    format: uri
                    nullable: true
                  previous:
                    type: string
                    format: uri
                    nullable: true
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/user_api.User'
  /user/v1/users/{id}/:
    get:
      operationId: user_v1_users_read
      description: DRF class for interacting with the User ORM object
      tags:
      - user
      parameters:
      - name: id
        in: path
        required: true
        description: A unique integer value identifying this пользователь.
        schema:
          type: integer
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/user_api.User'
  /user/v1/validation/registration:
    post:
      operationId: user_v1_validation_registration_create
      summary: POST /api/user/v1/validation/registration/
      description: "Expects request of the form\n```\n{\n    \"name\": \"Dan the Validator\",\n    \"username\": \"mslm\",\n    \"email\": \"mslm@gmail.com\",\n    \"confirm_email\": \"mslm@gmail.com\",\n    \"password\": \"password123\",\n    \"country\": \"PK\"\n}\n```\nwhere each key is the appropriate form field name and the value is\nuser input. One may enter individual inputs if needed. Some inputs\ncan get extra verification checks if entered along with others,\nlike when the password may not equal the username."
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/v2/account/registration/:
    get:
      operationId: user_v2_account_registration_list
      description: HTTP end-points for creating a new user.
      tags:
      - user
      responses:
        '200':
          description: ''
    post:
      operationId: user_v2_account_registration_create
      summary: Create the user's account.
      description: 'You must send all required form fields with the request.


        You can optionally send a "course_id" param to indicate in analytics

        events that the user registered while enrolling in a particular course.'
      tags:
      - user
      responses:
        '201':
          description: ''
  /user/{api_version}/account/login_session/:
    get:
      operationId: user_account_login_session_list
      description: HTTP end-points for logging in users.
      tags:
      - user
      parameters:
      - name: api_version
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
    post:
      operationId: user_account_login_session_create
      summary: POST /user/{api_version}/account/login_session/
      description: Returns 200 on success, and a detailed error message otherwise.
      tags:
      - user
      parameters:
      - name: api_version
        in: path
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                password:
                  type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  value:
                    type: string
                  error_code:
                    type: string
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  value:
                    type: string
                  error_code:
                    type: string
        '403':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  value:
                    type: string
                  error_code:
                    type: string
components:
  schemas:
    IDVerificationDetails:
      required:
      - status
      - expiration_datetime
      - updated_at
      type: object
      properties:
        type:
          title: Type
          type: string
          readOnly: true
        status:
          title: Status
          type: string
          minLength: 1
        expiration_datetime:
          title: Expiration datetime
          type: string
          format: date-time
        message:
          title: Message
          type: string
          readOnly: true
        updated_at:
          title: Updated at
          type: string
          format: date-time
        receipt_id:
          title: Receipt id
          type: string
          readOnly: true
    user_api.User:
      type: object
      properties:
        id:
          title: ID
          type: integer
          readOnly: true
        url:
          title: Url
          type: string
          format: uri
          readOnly: true
        email:
          title: Адрес электронной почты
          type: string
          format: email
          readOnly: true
          minLength: 1
        name:
          title: Name
          type: string
          readOnly: true
        username:
          title: Имя пользователя
          description: Обязательное поле. Не более 150 символов. Только буквы, цифры и символы @/./+/-/_.
          type: string
          readOnly: true
          minLength: 1
        preferences:
          title: Preferences
          type: string
          readOnly: true
    UserPreference:
      required:
      - user
      - key
      - value
      type: object
      properties:
        user:
          $ref: '#/components/schemas/user_api.User'
        key:
          title: Key
          type: string
          pattern: '[-_a-zA-Z0-9]+'
          maxLength: 255
          minLength: 1
        value:
          title: Value
          type: string
          minLength: 1
        url:
          title: Url
          type: string
          format: uri
          readOnly: true
    CountryTimeZone:
      required:
      - time_zone
      - description
      type: object
      properties:
        time_zone:
          title: Time zone
          type: string
          minLength: 1
        description:
          title: Description
          type: string
          minLength: 1
  securitySchemes:
    Basic:
      type: http
      scheme: basic