question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add header with total number of matched items

See original GitHub issue

Hi,

I’m writing a small app retrieving data from your API, using skip & limit, and displaying data in a paginated table.

Suppose that I want only the flight_id field for the launches endpoint, with 10 items per page. To know how many pages are available, I must do one of the following:

  • Either fetch the whole set with filter=flight_id & limit=999, but it is heavy and I prefer load data lazilly
  • Or do 2 requests:
    • one to fetch my data, with skip=0, limit=10 & filter=flight_id
    • and the other with limit=999 & filter=a_non_existent_field, to get only empty objects: lighter for both you and me.

I am currently using the 2nd solution. But it would be great:

  • either to have a query string parameter to ask only for the result count, to simplify & lighten the 2nd request
  • or to add a header or something in a normal API response with the total number of items.

The 2nd solution would be the best, IMO. Moreover, this information could be cached if no select query is present in the request.

What do you think about it ?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
jakewmeyercommented, Feb 21, 2019

@GerkinDev new redis caching is merged and live, should be good to go on this issue 👍

In addition to the new header, I also made slight changes to the caching header shown when the response is served from cache. spacex-api-cache is the new header, with potential values of HIT or MISS

1reaction
GerkinDevcommented, Feb 22, 2019

Yeeeeah that was quick! Thanks so much! 🍻

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use the Column Header to Retrieve Values from an Excel Table
MATCH will look for our report column header, such as Amount, in the ... This formula uses the SUMIFS function to add a...
Read more >
Add page numbers to a header or footer in Word
Add page numbers to a header or footer. Click or tap in the header or footer where you want the page numbers to...
Read more >
Matching Column Headers in a Sheets Query - YouTube
Columns can shift around in Sheets all the time - let's not let that break our queries.Using the MATCH function, we'll make sure...
Read more >
Sum matching columns - Excel formula - Exceljet
To sum values in columns by matching matching column headers, you can use a formula based on the SUMPRODUCT function. In the example...
Read more >
How to count total items in a column, if header name is provided
=SUM((OFFSET(B3,1,MATCH(D16,B3:J3,0)-1,10,1)<>"")*1). to be executed with Ctrl + Shift + Enter . The height set in this formula is 10 .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found