cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing $skip/$top inside Odata Batch requests in CAP Nodejs

sven-leonhardt
Explorer
0 Kudos
118

Hi community,

I'm trying to figure out the correct way to access the $skip and $top query parameters on a request that's inside a $batch request. The reason is, that I need to transform those parameters and pass the request on to a remote system.

this.on('READ', Contents, async (req: Request) => {
  ...
}

 

 

I tried req.query and req.http.req.query but both only return {}.

While debugging, I found that the following ways work but are undocumented, so I'm not sure if it's safe to use them.

console.log(req.req.query)   // {'$skip': '0', '$top': '20'}
console.log(req._.req.query) // {'$skip': '0', '$top': '20'}

Any recommendations?

View Entire Topic
WouterLemaire
Active Contributor
0 Kudos

You can find them in the query:

const skip = req.query.SELECT.limit?.offset?.val
const top = req.query.SELECT.limit?.rows?.val

sven-leonhardt
Explorer
0 Kudos
Thank you, this worked!