Newbie - please help with Tutorial 1 - Cannot get POST to work... #3157
-
Hello all, I am a newbie to PostgREST, Curl and JSON. This code fails with a
I get the following result:
The tutorial notes.config is:
Can anyone point me to where I have got it wrong? I've tried so many iterations of this and still get a failure! Also, the Tutorial 1 Shows this:
Using Windows command prompt, if I include the first line (with the token) windows tells me it is not a valid command. How or where, can I set the token so it does not have to be included everytime, and just be $TOKEN?? Thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
There are 3 separate authorization bits that I think you might have gotten mixed up on:
Consider in your example above; you placed the JWT token in the DB connect string as the password for the Don't worry! I'm also a newbie to this project (started last week) and stumbled a few times doing the setup. What I would suggest is going back again and re-reading carefully because it does work as written. But if you continue to have issues, check out the gitter channel linked on the README OR visit the discussion form linked to this project. |
Beta Was this translation helpful? Give feedback.
-
this is irrelevant because this only changes whether you use a config file or environment variables :)
Great!
Yeah, the section is titled Step 2. Make a Secret and then it uses 3 different terms to refer to exactly the same thing. Re-read that section and note that all these terms refer to the same thing; secret = password = jwt-secret.
Don't set this! This is probably why you're getting
This is a Unix/Linux shell thing. In windows I think it's more like set TOKEN=....
curl ... -H "Authorization: Bearer %TOKEN%" ... |
Beta Was this translation helpful? Give feedback.
-
@rotty3000 From another response I put single quotes around the URL, but still get a bad URL result.
Any other insights? This should not be this hard! |
Beta Was this translation helpful? Give feedback.
First of all, it's really hard to read the code snippets, commands and log outputs that you posted, because you were using single back-ticks only, which doesn't work well with multi-line strings. I changed all of those in the comments in this discussion to use triple back-ticks. Now I can actually read something.
The curl commands you are taking from the docs are written for linux. That means they have some specific syntax:
\
at the end of each line in the curl command. Those are "line continuation" markers and allow to split a single command into multiple lines. In your case it seems like you are putting the whole command in a single line - so you must remove the\
. A bit of go…