Closed brucer42 closed 4 months ago
What is the exact request you're doing and the response you're getting? If you're seeing an error like "permission denied for sequence..."
then you need to grant permissions to the SEQUENCE generated by serial
as seen in the Tutorial 1.
Purely by the tutorial, using secret 01234567012345670123456701234567, running in an emacs shell so using json_pp to print
brucer42@brucer42s-MBP postgrest % curl http://localhost:3000/todos -X POST \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidG9kb191c2VyIn0.qrlieu5zvSLJcyDFJ_ZoWTbLkDZbVm1LAsdtPKM7J1Y" \ -H "Prefer: return=headers-only" \ -H "Content-Type: application/json" \ -d '{"task": "learn how to auth"}' | json_pp curl http://localhost:3000/todos -X POST \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidG9kb191c2VyIn0.qrlieu5zvSLJcyDFJ_ZoWTbLkDZbVm1LAsdtPKM7J1Y" \ -H "Prefer: return=headers-only" \ -H "Content-Type: application/json" \ -d '{"task": "learn how to auth"}' **| json_pp**
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 29 0 0 100 29 0 534 --:--:-- --:--:-- --:--:-- 537 malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "(end of string)") at /usr/bin/json_pp5.30 line 52. brucer42@brucer42s-MBP postgrest % curl http://localhost:3000/todos -X POST \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidG9kb191c2VyIn0.qrlieu5zvSLJcyDFJ_ZoWTbLkDZbVm1LAsdtPKM7J1Y" \ -H "Prefer: return=representation" \ -H "Content-Type: application/json" \ -d '{"task": "learn how to auth"}' | json_pp curl http://localhost:3000/todos -X POST \ -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoidG9kb191c2VyIn0.qrlieu5zvSLJcyDFJ_ZoWTbLkDZbVm1LAsdtPKM7J1Y" \ -H "Prefer: return=representation" \ -H "Content-Type: application/json" \ -d '{"task": "learn how to auth"}' | json_pp % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 90 0 61 100 29 4468 2124 --:--:-- --:--:-- --:--:-- 6923 [ { "done" : false, "due" : null, "id" : 7, "task" : "learn how to auth" } ] brucer42@brucer42s-MBP postgrest %
Environment
Description of issue
Some research indicated (to me) that this was addressed in https://github.com/PostgREST/postgrest/commit/4b46c4eff329c91dc13b26c78b266c7361ecace4#diff-b032808b94623f64b08323b5ff13143d5ce0623cd14d49b4060ad1e417a19a6c
Prefer: return=headers-only HEADER does not return location information Prefer: return=representation does return full representation
I am using the tutorial with the todos table to reproduce this
(Steps to reproduce: Include a minimal SQL definition plus how you make the request to PostgREST and the response body)