Running into errors with a Curl command in doing Full Stack Web Dev Tutorial on Replit

Hello, I’ve been working on this full stack web development tutorial from YouTube, and I’m stuck on a part of the tutorial involving submitting a POST request via curl to MongoDB for the backend of a movie review application.

My replit for this tutorial is here.
The tutorial also contains a replit containing the code that was used in the tutorial located here.

Around 6:40:47, I’m trying to run the following curl command to submit a POST request:

curl -X POST https://e2d3d7f3-2d94-4ee2-8f7b-21a49c6063a5-00-w7s224w73s6n.riker.replit.dev/api/v1/reviews/new -H “Content-Type: application/json” -d ‘{“movieId”: 12, “user”: “beau”, “review”: “good”}’

The version of the command that appears in the tutorial is this:

curl -X POST https://review-backend.beaucarnes.repl.co/api/v1/reviews/new -H “Content-Type: application/json” -d ‘{“movieId”: 12, “user”: “beau”, “review”: “good”}’

When I type my version of the command in Replit’s shell, I get the following errors:

{"status":"success"}curl: (6) Could not resolve host: application
curl: (3) URL rejected: Bad hostname
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
curl: (3) URL rejected: Bad hostname
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
curl: (3) unmatched close brace/bracket in URL position 11:
“good”}’
          ^

Looking on Stack Overflow for a bit, I made some changes to my command to resolve the curl: (6) error and got to this so far:

curl -X POST https://e2d3d7f3-2d94-4ee2-8f7b-21a49c6063a5-00-w7s224w73s6n.riker.replit.dev/api/v1/reviews/new -H “Content-Type:application/json” -d ‘{“”movieId””: 12, “”user””: “”beau””, “”review””: “”good””}’

Which brings me the following error in replit’s shell.

400 Bad Requestcurl: (3) URL rejected: Bad hostname
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
curl: (3) URL rejected: Bad hostname
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
curl: (3) unmatched close brace/bracket in URL position 17:
“”good””}’
                ^

I’m having trouble understanding why the 400 Bad request and curl (3) errors are occurring, whether it’s an issue with my command, my code, the tutorial code, or replit itself, and I’d appreciate help with figuring out the issues and resolving them.

Update: I’ve figured out the problem: the quotes were the wrong characters, which is an issue I’ve run into in the past. I replaced them with the correct characters, and the command ran successfully.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.