Skip to content

Classroom Mode: Setup M2M-based (non-interactive) flows for accessing User Data #48414

Description

@raisedadead

Setup M2M-based (non-interactive) flows for Accessing User Data

One of the endpoints that the classroom team needs to return information in the below format:

Click here to explore the schema
{
    "[email protected]": {
        "blocks": {
            "learn-basic-css-by-building-a-cafe-menu": {
                "completedChallenges": [
                    {
                        "id": "5f33071498eb2472b87ddee4",
                        "completedDate": 1475094716730,
                        "files": []
                    },
                    {
                        "id": "5f3313e74582ad9d063e3a38",
                        "completedDate": 1537207306322,
                        "files": []
                    }
                ]
            },
            "learn-css-colors-by-building-a-set-of-colored-markers": {
                "completedChallenges": [
                    {
                        "id": "61695197ac34f0407e339882",
                        "completedDate": 1475094716730,
                        "files": []
                    },
                    {
                        "id": "61695ab9f6ffe951c16d03dd",
                        "completedDate": 1537207306322,
                        "files": []
                    }
                ]
            }
        }
    },
    
    "[email protected]": {
        "blocks": {
            "learn-basic-css-by-building-a-cafe-menu": {
                "completedChallenges": [
                    {
                        "id": "5f33071498eb2472b87ddee4",
                        "completedDate": 1475094716730,
                        "files": []
                    },
                    {
                        "id": "5f3313e74582ad9d063e3a38",
                        "completedDate": 1537207306322,
                        "files": []
                    }
                ]
            },
            "learn-css-colors-by-building-a-set-of-colored-markers": {
                "completedChallenges": [
                    {
                        "id": "61695197ac34f0407e339882",
                        "completedDate": 1475094716730,
                        "files": []
                    },
                    {
                        "id": "61695ab9f6ffe951c16d03dd",
                        "completedDate": 1537207306322,
                        "files": []
                    }
                ]
            }
        }
    }

}

Ref: https://gist.github.com/roberthuskins/04d8c767e1e6a0994440c94c2a00ece8

The implementation should ensure CORS and allow authorized access to the records as needed.

Activity

  1. self-assigned this
    on Nov 6, 2022
  2. changed the title [-]Create M2M endpoint for user data fetch[/-] [+]Setup M2M-based (non-interactive) flows for accessing User Data[/+] on Nov 10, 2022
  3. moved this to In Progress in Backend APIon Nov 10, 2022
  4. jeremyfiel commented on Dec 5, 2022

    @jeremyfiel
    Contributor

    the schema provided is invalid JSON Schema.

    I wrote the actual schema required to validate what I presume they are trying to interpret here.

    the File schema does not have any constraints and will validate against any type of data because the schema is not well described in the example provided. If someone can provide that, I can update the schema accordingly.

    Click to view the JSON Schema
    {
        "$schema": "http://json-schema.org/draft-07/schema#",
        "description": "<I need a description>",
        "type": "array",
        "uniqueItems": true,
        "additionalItems": false,
        "items": {
            "description": "username",
            "type": "object",
            "patternProperties": {
                ".*": {
                    "description": "A list of courses by username",
                    "type": "object",
                    "required": ["blocks"],
                    "properties": {
                        "blocks": {
                            "type": "array",
                            "uniqueItems": true,
                            "items": {
                                "description": "Challenge Name",
                                "type": "object",
                                "patternProperties": {
                                    ".*": {
                                        "type": "object",
                                        "properties": {
                                            "completedChallenges": {
                                                "type": "array",
                                                "uniqueItems": true,
                                                "additionalItems": false,
                                                "items": {
                                                    "$ref": "#/definitions/CompletedChallenge"
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "definitions": {
            "CompletedChallenge": {
                "description": "A representation of a completed challenge",
                "type": "object",
                "items": {
                    "$ref": "#/definitions/Challenge"
                }
            },
            "Challenge": {
                "description": "A representation of an individual challenge",
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "id": {
                        "description": "A unique identifier of a completed course",
                        "type": "string",
                        "minLength": 1
                    },
                    "completedDate": {
                        "description": "A Unix timestamp representation",
                        "type": "integer",
                    },
                    "files": {
                        "description": "A list of files pertaining to the challenge",
                        "type": "array",
                        "uniqueItems": true,
                        "additionalItems": false,
                        "items": {
                            "$ref": "#/definitions/File"
                        }
                    }
                }
            },
            "File": {
                "description": "A representation of a file",
                "type": "object"
            }
        }
    }
  5. jeremyfiel commented on Dec 5, 2022

    @jeremyfiel
    Contributor
    a valid example of a response based on the schema I provided
    [
        {
            "[email protected]": {
                "blocks": [
                    {
                        "learn-basic-css-by-building-a-cafe-menu": {
                            "completedChallenges": [
                                {
                                    "id": "5f33071498eb2472b87ddee4",
                                    "completedDate": 1475094716730,
                                    "files": []
                                },
                                {
                                    "id": "5f3313e74582ad9d063e3a38",
                                    "completedDate": 1537207306322,
                                    "files": []
                                }
                            ]
                        }
                    },
                    {
                        "learn-css-colors-by-building-a-set-of-colored-markers": {
                            "completedChallenges": [
                                {
                                    "id": "61695197ac34f0407e339882",
                                    "completedDate": 1475094716730,
                                    "files": []
                                },
                                {
                                    "id": "61695ab9f6ffe951c16d03dd",
                                    "completedDate": 1537207306322,
                                    "files": []
                                }
                            ]
                        }
                    }
                ]
            }
        },
        {
            "[email protected]": {
                "blocks": [
                    {
                        "learn-basic-css-by-building-a-cafe-menu": {
                            "completedChallenges": [
                                {
                                    "id": "5f33071498eb2472b87ddee4",
                                    "completedDate": 1475094716730,
                                    "files": []
                                },
                                {
                                    "id": "5f3313e74582ad9d063e3a38",
                                    "completedDate": 1537207306322,
                                    "files": []
                                }
                            ]
                        }
                    },
                    {
                        "learn-css-colors-by-building-a-set-of-colored-markers": {
                            "completedChallenges": [
                                {
                                    "id": "61695197ac34f0407e339882",
                                    "completedDate": 1475094716730,
                                    "files": []
                                },
                                {
                                    "id": "61695ab9f6ffe951c16d03dd",
                                    "completedDate": 1537207306322,
                                    "files": []
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
  6. changed the title [-]Setup M2M-based (non-interactive) flows for accessing User Data[/-] [+]Classrrom Mode: Setup M2M-based (non-interactive) flows for accessing User Data[/+] on Dec 22, 2022
  7. GuillermoFloresV commented on Jan 8, 2023

    @GuillermoFloresV
    Member

    Hi there, thanks for the feedback. We've revised our proposed JSON schema and this is what we've come up with. We're open to extra feedback with it and look forward to continuing the conversation! (a sample response has been attached at the bottom of this gist)

    https://gist.github.com/GuillermoFloresV/537054fbef353966bc11c0f720db2fc9

    As for the file schema not having constraints, it currently sits as an array of strings and I believe that I have provided the appropriate validation for it but if not please let me know and we can update it.

  8. jeremyfiel commented on Jan 20, 2023

    @jeremyfiel
    Contributor

    I've updated your schema to validate the payload you provided. I left the comment in the gist.

  9. GuillermoFloresV commented on Jan 21, 2023

    @GuillermoFloresV
    Member

    Hi Jeremy, I've also left a comment to address some of your questions. Let me know if you have further questions.

    @raisedadead , if you have a moment, could you take a look as well to make sure we are on the same page regarding the questions that Jeremy asked?

  10. added this to the Backend API MVP milestone on Aug 17, 2023
  11. moved this from In Progress to Discussing in Backend APIon Aug 17, 2023
  12. ShaunSHamilton commented on Sep 27, 2023

    @ShaunSHamilton
    Member

    @raisedadead Is this MVP?

    I was under the impression MVP was to match 1-1 the current API.

    EDIT: Answered in meeting. Yes, it is MVP, and will be added when developed.

  13. ojeytonwilliams commented on Jul 8, 2024

    @ojeytonwilliams
    Contributor

    There hasn't been any movement on this for a while and I don't recall the argument for making an exception for this. As such, I've moved it to the post-MVP milestone.

  14. changed the title [-]Classrrom Mode: Setup M2M-based (non-interactive) flows for accessing User Data[/-] [+]Classroom Mode: Setup M2M-based (non-interactive) flows for accessing User Data[/+] on Aug 1, 2024
  15. moved this from Discussing to In Progress in Backend APIon Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions