Chef activity: Chef Request

The Chef Request activity sends a Chef API request to a Chef server.

The Chef Request activity sends a Chef API request to a Chef server. This activity stores returned data in the responses sensor script variable as an array of JavaScript objects. Each object in the array contains the following fields.

Table 1. Array object fields
Object Definition
response_code The HTTP response code for the request
success A boolean value that indicates whether the request was successful or not
request_url The endpoint for the request
response_body The raw data returned from the Chef server
Note: All other Chef activities implement a specific Chef request and contain these fields in their sensor script variable. Some activities also contain additional fields in their sensor script variable.
Table 2. Results table
Result Definition
Success The Chef server returned a response. The activity returns a successful result even if one or more Chef requests failed. To determine the success of a specific request, use the success value from an object stored in the responses variable
Failure The Chef server was not available or rejected the supplied credentials
Table 3. Input variables table
Field Description
Method The type of REST function to execute. Possible values are GET, POST, PUT, and DELETE
Target data An array of JavaScript objects. Each object specifies these values:
  • targetPath: the target endpoint for this request. See the Chef API endpoint documentation for information on specifying an endpoint.
  • content: the body of the message, written in JSON, when using a PUT or POST REST message.