Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
titleBatch search query
{"request":{"filters":{ "courseId" : ["do_112634552998936576175","do_112634535631675392173","do_112633845274157056122"],"status":["0","1"],"enrollmentType":"open"},
"sort_by":{"createdDate":"desc"}
}
}


          

ProsCons
  1. Existing api can be re-used.
  1. Caller (portal/app) need to make one extra api call and then then need to merge both response
  2. Caller need to make one more api call to get my enroll course
  3. It can have performance issues .



Proposed Solution 3:

Sunbird will expose a new api to get open batch count for list of courseIds. New api details will be as follows:

 

Wiki Markupcode
languagejs
titlenew api to get course batch count
URI: v1/course/batch/count
Methods: POST
Request body 1:
{
 "request": {
     "filters":{
             "courseId":["courseId-1","courseId-2"],
              "status":["0","1"],     
              "enrollmentType":"open"
            }
       }
}


Request body 2:
{
 "request": {
     "filters":{
             "courseId":["courseId-1","courseId-2"]
            }
       }
}


Request body 3:
{
 "request": {
     
             "courseId":["courseId-1","courseId-2"]
       }
}




----
Response:
{
    "id": "api.course.batch.count",
    "ver": "v1",
    "ts": "2018-11-20 17:53:00:716+0000",
    "params": {
        "resmsgid": null,
        "msgid": "8e27cbf5-e299-43b0-bca7-8347f7e5abcf",
        "err": null,
        "status": "success",
        "errmsg": null
    },
    "responseCode": "OK",
    "result": {
        "response": {
            "count": 8,
            "content": [
                {
                    "courseId": "do_2126299478299033601672",
                    "openBatchCount":2,
                    "inviteOnlyBatchCount":0
                 },
                {
                    "courseId": "do_2126299478299033601672",
                    "openBatchCount":2,
                    "inviteOnlyBatchCount":0 
               }
            ]
        }
    }
}

...


ProsCons
  1. Easy to manage , later any other changes can be easily incorporated.
  2. Only one api call that will handle complete business logic  
  3. Using request body 2 or 3 will provide flexibility to move complete business logic on server side.
  1.  new api need to be introduce



Open Questions :

  1.  If one course have 3  open batches and caller already enrolled for one batch then do we need to sent open batch count as 3 or 2 or for him there is no open batch to do enroll.