Home > Mobile >  How to eliminate the extra parameters from ORDS
How to eliminate the extra parameters from ORDS

Time:03-12

I am using sql developer and ORDS to enable a front end to fetch data. In the data returned through the REST service, I am getting parameters like "hasMore":false,"limit":25,"offset":0,"count":4,"links":

along with actual data.

How can I fetch ONLY actual data ?

Example:

{
   "items":[
      {
         "empid":1,
         "ename":"hello"
      },
      {
         "empid":3,
         "ename":"hello"
      },
      {
         "empid":2,
         "ename":"hello"
      },
      {
         "empid":4,
         "ename":"hello"
      }
   ],
   "hasMore":false,
   "limit":0,
   "offset":0,
   "count":4,
   "links":[
      {
         "rel":"self",
         "href":"http://localhost:8081/ords/vinayak/dem/employees/"
      },
      {
         "rel":"describedby",
         "href":"http://localhost:8081/ords/vinayak/metadata-catalog/dem/employees/"
      }
   ]
}

This is the output i am getting. But I want it as

    {
   "items":[
      {
         "empid":1,
         "ename":"hello"
      },
      {
         "empid":3,
         "ename":"hello"
      },
      {
         "empid":2,
         "ename":"hello"
      },
      {
         "empid":4,
         "ename":"hello"
      }
   ]
}

CodePudding user response:

Generally you're going to get pagination by default for query requests, because we don't know how much data you might be getting. You can turn that off by setting page size to 0 for your module.

But of course, its now up to you to ensure you don't get into troubles with unlimited sized JSON documents being built and passed over the wire.

CodePudding user response:

REST APIs are by nature LINK driven, this is one of the core concepts behind Oracle REST Data Services (ORDS).

The concept is known as HATEOAS (Hypermedia as the Engine of Application State) is a constraint of the REST application architecture. HATEOAS keeps the REST style architecture unique from most other network application architectures.

enter image description here

Deprecated means we've told you we don't plan to support this forever. The feature could go away in a future release.

And not to be preachy, but if you have lots of records, you'll want paging, and then you're going to want those links. Your javascript apps / frameworks / whatever should be flexible enough to ignore the json attributes and links you don't care to use.

Disclaimer: I'm a product manager at Oracle, and ORDS is one of my products.

  • Related