knife raw

[edit on GitHub]

Use the knife raw subcommand to send a REST request to an endpoint in the Chef Infra Server API.

Syntax

This subcommand has the following syntax:

knife raw REQUEST_PATH (options)

Options

Note

Review the list of common options available to this (and all) knife subcommands and plugins.

This subcommand has the following options:

-i FILE, --input FILE

The name of a file to be used with the PUT or a POST request.

--[no-]pretty

Use --no-pretty to disable pretty-print output for JSON. Default: --pretty.

-m METHOD, --method METHOD

The request method: DELETE, GET, POST, or PUT. Default value: GET.

--proxy-auth

Enable proxy authentication to the Chef Infra Server web user interface. Default value: false.

Note

See config.rb for more information about how to add certain knife options as settings in the config.rb file.

Examples

The following examples show how to use this knife subcommand:

View a client

To view information about a client:

knife raw /clients/<client_name>

View a node

To view information about a node:

knife raw /nodes/<node_name>

Delete a data bag

To delete a data bag, enter a command similar to:

knife raw -m DELETE /data/foo

to return something similar to:

{
  "name":"foo",
  "json_class":"Chef::DataBag",
  "chef_type":"data_bag"
}

Delete a role

To delete a role, enter a command similar to:

knife raw -m DELETE /roles/role-foo.json

to return something similar to:

{
  "name":"role-foo",
  "json_class":"Chef::Role",
  "chef_type":"role"
}

© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/workstation/knife_raw/