-
Notifications
You must be signed in to change notification settings - Fork 18
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
Comments
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. 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! |
Unfortunately, it's not possible in PostgREST to do so. |
@VinceT, I found this on the docs: https://postgrest.org/en/v12/references/api/aggregate_functions.html#the-case-of-count I'm closing this ticket as it was added to our internal backlog as a feature request and we will be tracking it there. |
Hi,
Nice ! Thanks for this.
It works in the opposite way that the doc indicates. That is : no
parenthesis gives the result and () gives a PGRST123 error message.
Anyway, it's useful.
Le mar. 30 avr. 2024 à 03:41, rzambroni ***@***.***> a écrit :
… @VinceT <https://github.com/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!
—
Reply to this email directly, view it on GitHub
<#2840 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADGHWUZHB6QX5YPVXNJBQDY73ZC7AVCNFSM6AAAAABG7CTRN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBUGEYDSNBWG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Great, i'm glad it worked! Have a great week. |
Has your issue been reported?
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
Bug Report Code (Required)
IT4wi8mAw49grs9e+KryccFsimEvIjs3aq801upubCs9GYjyO5YUac6lV1hWXdekSmw+KEWGjnoG0sr7uN/QV/AnGyuubr5Dys1ASg/vcEW/aoS6DbWOfHFTP+BmJkOP0ZiVuglQHNpecXAW1F+PeuvKEnLsN4P7Zwh9f6PHaOI=
Context
Impossible to get a count.
Visual documentation
Additional Info
No response
Environment
General
Relative to the time the changes were made, data was lost within
When following my steps to reproduce, data loss happens
The text was updated successfully, but these errors were encountered: