Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using limit=0 and details=on to get only the count of elements #1492

Closed
fgalan opened this issue Nov 11, 2015 · 7 comments
Closed

Using limit=0 and details=on to get only the count of elements #1492

fgalan opened this issue Nov 11, 2015 · 7 comments
Labels
APIv2.1 To be included in a potential NGSI v2.1 API version good first issue
Milestone

Comments

@fgalan
Copy link
Member

fgalan commented Nov 11, 2015

(Feedback from ECFI 2015 at Hamburg)

Currenetly limit=0 returns an error:

fermin@neodeb:~/ecfi$ curl --header 'Accept: application/json' --header 'Fiware-service: devguide' 'localhost:1026/v1/contextEntities?limit=0&details=on'
{
  "orionError" : {
    "code" : "400",
    "reasonPhrase" : "Bad Request",
    "details" : "Bad pagination limit: /0/ [a value of ZERO is unacceptable]"
  }
}

However, ?limit=0&details=on has been suggested as a way of getting only the count for entities.

The "projection" of this idea in NGSIv2 could be taken into account.

@jmcanterafonseca
Copy link
Contributor

in NGSIv2 we have options=count . so if we say limit=0&options=count then yes it should be a valid operation and return success

@fgalan fgalan modified the milestone: NGSIv2SpecPending Jun 22, 2016
@fgalan
Copy link
Member Author

fgalan commented Apr 27, 2018

We should suppport:

GET /v2/entities?limit=0&options=count
200 OK
Fiware-total-count: 2321
[]

and also this one (useless, but semantically correct):

GET /v2/entities?limit=0
200 OK
[]

@fgalan fgalan added APIv2.1 To be included in a potential NGSI v2.1 API version and removed APIv2 labels Jul 12, 2018
@fgalan
Copy link
Member Author

fgalan commented Jul 12, 2018

Out of the scope of NGSIv2, althouth it is a good idea that could (potentially) be included in a later version of the API (v2.1) in a backward compatible way.

CC: @jmcanterafonseca

@fgalan fgalan removed this from the NGSIv2SpecPending milestone Jul 12, 2018
@Anjali-NEC
Copy link
Contributor

Hi @fgalan Sir,

I would like to work on this issue. please let me know if this issue still need to be fix?

@fgalan
Copy link
Member Author

fgalan commented Nov 8, 2021

Thanks for your willingness to work on this issue!

As far as I understand, the issue is still valid. This comment contains and specification of what needs to be implemented: #1492 (comment)

@Anjali-NEC
Copy link
Contributor

I have fixed this issue. Please review my PR #3994 if it is ok then please merge it into master.

fgalan added a commit that referenced this issue Apr 27, 2022
Fix using limit=0 and details=on to get only the count of elements #1492
@fgalan
Copy link
Member Author

fgalan commented Apr 27, 2022

I have fixed this issue. Please review my PR #3994 if it is ok then please merge it into master.

Merged in prelanding branch, the work continues in PR #4104

@fgalan fgalan added this to the 3.7.0 milestone Apr 28, 2022
@fgalan fgalan closed this as completed Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIv2.1 To be included in a potential NGSI v2.1 API version good first issue
Projects
None yet
Development

No branches or pull requests

3 participants