Wiki

Clone wiki

susrpp / API DOC

SusRpp API

* = requires authentication, it can be made either using HTTP Session, request parameter (sesstoken), or request header (X-SESSIONTOKEN).

@ = will returns an http session.

Use your own http://localhost/ or demo site at http://rpp.y--v.com/

Useful tool: http://www.getpostman.com/

User API

POST /api/user/auth' parameter: username, password response: {success: '...'} | {error: '...'}

GET /api/user/validate/{token} parameter: - response: {valid: false|true}

POST /api/user/session/auth parameter: username, password response: {success: '...'} | {error: '...'} @

GET /api/user/session/forget @

GET /api/user/{id} *

POST /api/user/register body: json *

PUT /api/user/update body: json *

DELETE /api/user/{id} *

Subject API

GET /api/subject/all or /api/subject *

GET /api/subject/find parameter: subjectname *

GET /api/subject/{id} *

POST /api/subject body: json *

PUT /api/subject body: json *

DELETE /api/subject/{id} *

Item API

GET /api/item/find parameter: by=<author|title|theme>, value *

GET /api/item/findone parameter: by=<title>, value=<the title> *

GET /api/item/{id} *

POST /api/item body: json *

PUT /api/item body: json *

DELETE /api/item/{id} *

Sample JSON format

Subject

  • _id is not needed to create new subjects (and it must not present). It is only used for updating or getting a specific subject.
  • This sample below is in many (array) form.
    #!json
    [
        {
            "subjectName": "IPA Kelas VI SD",
            "coreCompetences": [
                {
                    "number": "1",
                    "description": "Menerima, menjalankan, dan menghargai ajaran agama yang dianutnya",
                    "basicCompetences": [
                        {
                            "number": "1.1",
                            "description": "Lorem Ipsum Dolor Sit Amet",
                            "basicCompetences": null
                        }
                    ]
                },
                {
                    "number": "2",
                    "description": "Lorem Ipsum Dolor Sit Amet",
                    "basicCompetences": [
                        {
                            "number": "2.1",
                            "description": "Lorem Ipsum Dolor Sit Amet",
                            "basicCompetences": null
                        },
                        {
                            "number": "2.2",
                            "description": "Lorem Ipsum Dolor Sit Amet",
                            "basicCompetences": null
                        }
                    ]
                }
            ],
            "_id": "52da3a66c4aaf8594b792d69"
        },
        {
            "subjectName": "Matematika Kelas IV SD",
            "coreCompetences": [
                {
                    "number": "1",
                    "description": "Menerima, menjalankan, dan\nmenghargai ajaran agama yang\ndianutnya",
                    "basicCompetences": [
                        {
                            "number": "1.1",
                            "description": "-",
                            "basicCompetences": null
                        }
                    ]
                },
                {
                    "number": "2",
                    "description": "Lorem Ipsum Dolor Sit Amet",
                    "basicCompetences": [
                        {
                            "number": "2.1",
                            "description": "Lorem Ipsum Dolor Sit Amet",
                            "basicCompetences": null
                        },
                        {
                            "number": "2.2",
                            "description": "Lorem Ipsum Dolor Sit Amet",
                            "basicCompetences": null
                        },
                        {
                            "number": "2.3",
                            "description": "Lorem Ipsum Dolor Sit Amet",
                            "basicCompetences": null
                        }
                    ]
                }
            ],
            "_id": "52da3a66c4aaf8594b792d6a"
        }
    ]
    

Item

  • _id is not needed to create new items (and it must not present). It is only used for updating or getting a specific item.
    #!json
    
    {
        "title": "Item One",
        "status": "draft",
        "authors": [
            "Boromir",
            "Frodo"
        ],
        "description": "Description One",
        "lookup": "description one",
        "tags": [
            "testitem",
            "lotr",
            "lingkungan",
            "ipa",
            "ips"
        ],
        "data": {
            "school": "SDN 30 Semarang",
            "topic": "Pemanasan Global",
            "theme": "Lingkungan",
            "term": 1,
            "relatedSubjects": [
                {
                    "subjectId": null,
                    "subjectName": "IPS",
                    "coreCompetence": "2. Lingkungan Sosial",
                    "basicCompetence": [
                        "2.3. Lingkungan Sosial"
                    ],
                    "indicator": [
                        "Kemampuan beradaptasi dengan lingkungan sosial"
                    ]
                },
                {
                    "subjectId": null,
                    "subjectName": "IPA",
                    "coreCompetence": "5. Alam dan Kehidupan",
                    "basicCompetence": [
                        "5.1. Alam",
                        "5.2. Kehidupan"
                    ],
                    "indicator": [
                        "Mengerti simbiosis mutualisme antar makhluk hidup"
                    ]
                }
            ],
            "goals": [
                "Mengerti definisi Pemanasan Global",
                "Mampu menciptakan lingkungan yang baik"
            ],
            "materials": "Item One Materials",
            "activities": {
                "learnApproach": [
                    "Interaktif"
                ],
                "learnMethods": [
                    "Lecture",
                    "Diskusi",
                    "Praktikum"
                ],
                "learnModels": [
    
                ],
                "startActivities": [
                    {
                        "action": "Activity Start",
                        "actionDetail": "Activity Start",
                        "response": "No Response",
                        "replyToResponse": "-",
                        "replyToResponseDetail": "-",
                        "duration": -1
                    }
                ],
                "startDuration": 5,
                "coreActivities": [
                    {
                        "action": "Activity Core",
                        "actionDetail": "Activity Core",
                        "response": "No Response",
                        "replyToResponse": "-",
                        "replyToResponseDetail": "-",
                        "duration": 60
                    }
                ],
                "closingActivities": [
                    {
                        "action": "Activity Closing",
                        "actionDetail": "Activity Closing",
                        "response": "No Response",
                        "replyToResponse": "-",
                        "replyToResponseDetail": "-",
                        "duration": -1
                    }
                ],
                "closingDuration": 10
            },
            "resources": [
                "Buku Lingkungan",
                "Slide lingkungan"
            ],
            "assessment": {
                "multipleChoice": [
                    {
                        "indicator": "Indicator A",
                        "question": "Salah satu penyebab Pemanasan Global adalah:",
                        "options": [
                            "Turunnya salju",
                            "Emisi kendaraan bermotor",
                            "Jarang mandi",
                            "Reboisasi"
                        ],
                        "solution": "Emisi kendaraan bermotor",
                        "score": 25,
                        "cognitiveLevel": "C1"
                    },
                    {
                        "indicator": "Indicator B",
                        "question": "Apa yang dimaksud dengan reboisasi?",
                        "options": [
                            "Penanaman hutan kembali",
                            "Penebangan liar",
                            "Pengrusakan alam",
                            "Hujan asam"
                        ],
                        "solution": "Penanaman hutan kembali",
                        "score": 25,
                        "cognitiveLevel": "C1"
                    }
                ],
                "essay": [
                    {
                        "indicator": "Indicator C",
                        "question": "Sebutkan dan jelaskan 2 penyebab Pemanasan Global menurut anda!",
                        "solutions": [
                            {
                                "keyPoint": "Polusi",
                                "score": 25
                            },
                            {
                                "keyPoint": "Kerusakan Hutan",
                                "score": 25
                            }
                        ],
                        "cognitiveLevel": "C1"
                    }
                ],
                "simpleQuiz": [
                    {
                        "indicator": "Indicator D",
                        "question": "Apa nama planet yang dihuni manusia saat ini?",
                        "solution": "Bumi",
                        "score": 25,
                        "cognitiveLevel": "C1"
                    }
                ],
                "matching": [
                    {
                        "indicator": "Indicator X",
                        "question": "Pasangkan P... dengan Q...",
                        "pairA": "A B C D E F G",
                        "pairB": "1 2 3 4 5 6 7",
                        "solution": "A-2 B-1 C-3 D-4 E-5 F-6 G-7",
                        "cognitiveLevel": "C1"
                    }
                ]
            }
        },
        "_id": "52db52f03e1c4c4d2d57c56f"
    }
    

User

  • Password is only needed in case of registering a user or changing a user password. Getting user information via /api/user/<username> doesn't include password.
    #!json
    
    {
        "username": "valjean",
        "email": "valjean@example.com",
        "name": "Jean Valjean",
        "password": "VerySecretPassword",
    }
    

Updated