This will work, assuming you are using Windows?
curl -X POST -H "Content-Type: application/json" -d "{ \"auth_token\": \"YOUR_AUTH_TOKEN\", \"text\": \"Hey, Look what I can do!\" }" http://localhost:3030/widgets/welcome
문제
I am new to dashing, followed the instructions found here and just managed to get the "sweet_dashboard_project" up and running successfully.
At the bottom of the dashboard it says:
"Try this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://localhost:3030/widgets/welcome"
When I try it, the following error occurs:
curl: (6) Could not resolve host: auth_token
curl: (6) Could not resolve host: YOUR_AUTH_TOKEN,
curl: (6) Could not resolve host: text
curl: (6) Could not resolve host: Hey, Look what I can do!
curl: (3) [globbing] unmatched close brace/bracket in column 1
curl: (1) Protocol \http not supported or disabled in libcurl
config.ru looks like this
require 'dashing'
configure do
set :auth_token, 'YOUR_AUTH_TOKEN'
helpers do
def protected!
# Put any authentication code you want in here.
# This method is run before accessing any resource.
end
end
end
map Sinatra::Application.assets_prefix do
run Sinatra::Application.sprockets
end
run Sinatra::Application
What am I doing wrong here?
Thanks!
해결책 2
This will work, assuming you are using Windows?
curl -X POST -H "Content-Type: application/json" -d "{ \"auth_token\": \"YOUR_AUTH_TOKEN\", \"text\": \"Hey, Look what I can do!\" }" http://localhost:3030/widgets/welcome
다른 팁
you are using \http
which is incorrect.
Also, put double quote around the json(if you use windows). Use header application/json
.
curl -d "{ \"auth_token\": \"YOUR_AUTH_TOKEN\", \"text\": \"Hey, Look what I can do!\" }' -H "Content-Type: application/json" http://localhost:3030/widgets/welcome