CoAP-CLI
============================

[![Tests](https://github.com/avency/coap-cli/actions/workflows/run_tests.yml/badge.svg?branch=main)](https://github.com/avency/coap-cli/actions/workflows/run_tests.yml)
[![npm version](https://badge.fury.io/js/coap-cli.svg)](https://npmjs.org/package/coap-cli)

__CoAP-CLI__ is a command line interface for CoAP, built on node.js and
[node-coap](http://github.com/mcollina/node-coap).

What is CoAP?
----------------------------

> Constrained Application Protocol (CoAP) is a software protocol
intended to be used in very simple electronics devices that allows them
to communicate interactively over the Internet. -  Wikipedia

Install
----------------------------

Install [node.js](http://nodejs.org), and then from a terminal:
```
npm install coap-cli -g
```

Usage
----------------------------

```
  Usage: coap command [options] url


  Commands:

    get      performs a GET request
    put      performs a PUT request
    post     performs a POST request
    delete   performs a DELETE request

  Options:

    -h, --help                    output usage information
    -V, --version                 output the version number
    -o, --observe                 Observe the given resource
    -n, --no-new-line             No new line at the end of the stream
    -p, --payload <payload>       The payload for POST and PUT requests
    -b, --block2 <option>         set the block2 size option
    -q, --quiet                   Do not print status codes of received packets
    -c, --non-confirmable         non-confirmable
    -t, --timeout <seconds>       The maximum send time in seconds
    -T, --show-timing             Print request time, handy for simple performance tests
    -O, --coap-option <key,value> Add COAP-Option to the request (repeatable)
```

### PUT and POST

__PUT__ and __POST__ requests body are sent from the standard
input by default. E.g.
```
echo -n 'hello world' | coap post coap://localhost/message
```

If you want to type it you can end the standard input by pressing
CTRL-D.

License
----------------------------

Copyright (c) 2013 Matteo Collina

node-coap is licensed under an MIT +no-false-attribs license.
All rights not explicitly granted in the MIT license are reserved.
See the included LICENSE file for more details.
