0

I have an API http://studentresults.com/studentresults?studentname=xyz&date=dd/mm/yyyy

With the above url, I get JSON information w.r.t to student name on that date of examination. I can get the JSON information for single student by parsing url using node js. Now I have 15 students. How to get to all the information on that particular day of examination so that I create object such as

          {
               "date": dd/mm/yyyy
                 'studentresults': [
                  { 'studentname' = xyz , marks = 500 },
                  { 'studentname' = abc , marks = 525 },
                   so on
                  ]
           }

In the above url, by changing the student name we get information of one student details. if i need to get all the students details how it can be done ? instead of changing every time how can i pass a array of studentnames to url so that i can all the information at once ?

1 Answers1

0

Assuming you can edit the api:

If you get url with "studentname" (one) and "date" get the desired student data.

url.com/studentresults?studentname=xyz&date=dd/mm/yyyy

Else if you get url with multiple studentnames then you need to check if "studentname" is an array.

url.com/studentresults?studentname=student1,student2&date=dd/mm/yyyy

More details how to pass array to url

Else if you get only date then try getting all the results of the day.

url.com/studentresults?date=dd/mm/yyyy

If you can't edit then you must check the API for allowed parameters which can be passed.

Community
  • 1
  • 1
Renārs Vilnis
  • 1,160
  • 1
  • 10
  • 24