Skip to content

API for a array of objects, unclear documentation on API #112

@fayazara

Description

@fayazara

I have a array objects like this

[
    {
      "id": 1,
      "name": "Abc Def",
      "semester": 1,
      "fees": "Paid"
    },
    {
      "id": 2,
      "name": "Qwe Rty",
      "semester": 3,
      "fees": "Pending"
    },
    {
      "id": 3,
      "name": "Qwe Rty",
      "semester": 3,
      "fees": "Pending"
    }
  ]

When I try to use it as a api, it auto converts it to a object and adds a key to each object. How do I even read this?

My students.json array is converted to a object with keys(numbers increamented).

response

What do I do to get the array instead of a object, how do I access a specific object say student 2 or object 2 from my array.

How do I query this data, like only or where and sortBy, is it also possible to paginate the data (my array of students, eventually it will be crossing 200 students with each object containing more details)

I tried adding querying with only like this http://localhost:3000/api/students?only=title it responds with empty object
image

I might be trying to use it the wrong way, but this would solve me a lot of problems, like instead of using a Headless CMS via its api, everything will be handled locally

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions