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

HEAD method not supported in API calls #2840

Closed
3 of 19 tasks
VinceT opened this issue Apr 29, 2024 · 5 comments
Closed
3 of 19 tasks

HEAD method not supported in API calls #2840

VinceT opened this issue Apr 29, 2024 · 5 comments

Comments

@VinceT
Copy link

VinceT commented Apr 29, 2024

Has your issue been reported?

  • I have searched the existing issues and confirm it has not been reported.
  • I give permission for members of the FlutterFlow team to access and test my project for the sole purpose of investigating this issue.

Current Behavior

Hi,
I use PostgREST. I tested the "GET" method which works fine. But I want to count records and the only way is to use "HEAD" (https://postgrest.org/en/v12/references/api/pagination_count.html#exact-count). It works on other projects I have (PHP, Capacitor). It seems that only GET, POST, DELETE, PUT and PATCH are available.

Expected Behavior

Is there a work-around to count records ?

Steps to Reproduce

Create a new API call

Reproducible from Blank

  • The steps to reproduce above start from a blank project.

Bug Report Code (Required)

IT4wi8mAw49grs9e+KryccFsimEvIjs3aq801upubCs9GYjyO5YUac6lV1hWXdekSmw+KEWGjnoG0sr7uN/QV/AnGyuubr5Dys1ASg/vcEW/aoS6DbWOfHFTP+BmJkOP0ZiVuglQHNpecXAW1F+PeuvKEnLsN4P7Zwh9f6PHaOI=

Context

Impossible to get a count.

Visual documentation

image

Additional Info

No response

Environment

- FlutterFlow version: FlutterFlow v4.1.45+ released April 26, 2024
Flutter version is 3.19.1
- Platform:
- Browser name and version:Chrome Version 124.0.6367.92 (Build officiel) (64 bits)
- Operating system and version affected: Windows 10 Version 22H2

General

  • I was collaborating with other users in the same project prior to data loss
  • I navigated between different project views leading up to data loss
  • The UI was running very slowly prior to data loss
  • A crash or other bug occurred prior to data loss
  • Data was not saved in a snapshot
  • I was using flutterflow from multiple devices
  • I was using flutterflow from multiple platforms (e.g. both web and MacOS Desktop app)

Relative to the time the changes were made, data was lost within

  • 1 minute
  • 1 hour
  • 1 day
  • 1 week

When following my steps to reproduce, data loss happens

  • ~100% of the time
  • ~50% of the time
  • ~10% of the time
  • ~1% of the time
  • Very rarely or only encountered once
@VinceT VinceT added the status: needs triage A potential issue that has not been confirmed as a bug. label Apr 29, 2024
@rzambroni rzambroni self-assigned this Apr 29, 2024
Copy link
Collaborator

Hey @VinceT, as you said there is currently no support for HEAD calls.

I don't have any context of your backend, but you should be able perform a count by using the SQL query itself and retrieve it on a GET request.

Something like:

SELECT COUNT(*) AS user_count FROM users;

Hope that helps!

I will add a feature request for the head calls, however, i don't think they will be a priority for the team in the short term.

Thanks!

@rzambroni rzambroni removed the status: needs triage A potential issue that has not been confirmed as a bug. label Apr 29, 2024
@VinceT
Copy link
Author

VinceT commented Apr 29, 2024

Unfortunately, it's not possible in PostgREST to do so.
Based on "http://my_site/my_table?select=field1,field2"
"http://my_site/my_table?select=count%28*%29" is not allowed and generates a PGRST100 Error.

Copy link
Collaborator

@VinceT, I found this on the docs: https://postgrest.org/en/v12/references/api/aggregate_functions.html#the-case-of-count
It could probably help you, but I'm not an expert on the matter.

I'm closing this ticket as it was added to our internal backlog as a feature request and we will be tracking it there.

Thanks!

@rzambroni rzambroni closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
@VinceT
Copy link
Author

VinceT commented Apr 30, 2024 via email

Copy link
Collaborator

Great, i'm glad it worked!

Have a great week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants