ungdev / etuutt-api

Users, classes, assos : An awesome API to rule them all
MIT License
2 stars 2 forks source link

Get the list of all semesters, and semester of a date #13

Open ThomasRitaine opened 3 years ago

ThomasRitaine commented 3 years ago

The API should have this response when requesting "/api/semesters" with the GET method.

{
  "@context": "/api/contexts/semester",
  "@id": "/api/semesters",
  "@type": "hydra:Collection",
  "hydra:member": [
    {
      "@id": "/api/semesters/A19",
      "@type": "semester",
      "code": "A19",
      "start": "2019-07-31",
      "end": "2020-01-31"
    },
    {
      "@id": "/api/semesters/P20",
      "@type": "semester",
      "code": "P20",
      "start": "2020-01-31",
      "end": "2020-07-31"
    }
  ],
  "hydra:totalItems": 100,
  "hydra:view": {
    "@id": "/api/ues?page=1",
    "@type": "hydra:PartialCollectionView",
    "hydra:first": "/api/ues?page=1",
    "hydra:last": "/api/ues?page=4",
    "hydra:next": "/api/ues?page=2"
  }
}

And the API should have this response when requesting "/api/semesters?date=2020-03-25" with the GET method.

{
  "@context": "/api/contexts/semester",
  "@id": "/api/semesters/P20",
  "@type": "ue",
  "@type": "semester",
  "code": "P20",
  "start": "2020-01-31",
  "end": "2020-07-31"
}