hectorJDH
hectorJDH

Reputation: 21

curl: (3) unmatched close brace/bracket in URL position x

Im coding while reading a book and I need to write this on the console:

curl "http://localhost:3000/graphql" -H "Accept-Encoding: gzip, deflate, br" -H "Content-Type: application/json" -H "Accept: application/json" -H "Connection: keep-alive" -H "DNT: 1" -H "Origin: http://localhost:3000" --data-binary "{"query":"query {\n about\n}\n"}" -compressed{"data":{"about":"Hello World!"}}

but it returns me the error: Error (the bold is the character that returns me the error.)

curl: (3) unmatched brace in URL position 1:{\n

I have tried:

curl "http://localhost:3000/graphql" -H "Accept-Encoding: gzip, deflate, br" -H "Content-Type: application/json" -H "Accept: application/json" -H "Connection: keep-alive" -H "DNT: 1" -H "Origin: http://localhost:3000" --data-binary "{\"query\":\"query {\n about\n}\n\"}" –compressed{\"data\":{\"about\":\"Hello World!\"}}

but it gives me the error: This error (the bold is the character that returns me the error.)

curl: (3) unmatched close brace/bracket in URL position 8: World!"}}

I think is probably the syntax but I dont know, Im kind of stuck here :{

Upvotes: 0

Views: 2886

Answers (1)

hectorJDH
hectorJDH

Reputation: 21

This is kind of funny, so this was on the book:

curl "http://localhost:3000/graphql" -H "Accept-Encoding: gzip, deflate, br" -H "Content-Type: application/json" -H "Accept: application/json" -H "Connection: keep-alive" -H "DNT: 1" -H "Origin: http://localhost:3000" --data-binary "{"query":"query {\n about\n}\n"}" -compressed{"data":{"about":"Hello World!"}}

it was all joined, the snippet that goes in the CMD is just

curl "http://localhost:3000/graphql" -H "Accept-Encoding: gzip, deflate, br" -H "Content-Type: application/json" -H "Accept: application/json" -H "Connection: keep-alive" -H "DNT: 1" -H "Origin: http://localhost:3000" --data-binary "{"query":"query {\n about\n}\n"}" -compressed

and it returned:

{"data":{"about":"Hello World!"}}

from a snippet I modified in a sandbox in Apollo...

So..., its a little embarrassing but I'm going to leave it here as a reminder xD

Upvotes: 1

Related Questions