Skip to main content

coap

CoAP client to test golioth coap gateway

coap [flags]

Examples

# Send a GET request to /hello
coap --path /hello -m GET --psk-id deadbeef-id --psk supersecret --host coap.golioth.io

# Send a POST request to /echo
# With body as string (-b)
coap --path /echo -m POST --psk-id deadbeef-id --psk supersecret --host coap.golioth.io -b "Hello"
# With body from file (-f)
coap --path /echo -m POST --psk-id deadbeef-id --psk supersecret --host coap.golioth.io -f ./test.txt

# Send a POST request to /logs
coap --path /logs -m POST --psk-id deadbeef-id --psk supersecret -q module=wifi -q msg="Signal from router" -q level=info -b "{ \"wifi-rssi\": -45 }" --format json --host coap.golioth.io

Options

      --accept string          coap accept format
-b, --body string coap body
-f, --file string file to be sent on the request body
--format string coap body format
-h, --help help for coap
--host string golioth coap host (default "localhost")
--in read request body from stdin
-m, --method string coap method - GET,POST (default "GET")
-o, --observe stringArray coap observation paths
--out string file to save response body
-p, --path string coap url path (default "/echo")
--port int golioth coap port (default 5684)
--psk string coap pre shared key
--psk-id string coap psk identity
-q, --query stringToString coap query params (default [])
--timeout uint coap request timeout in seconds (default 5)
-w, --wait wait for replies

SEE ALSO