Skip to content

Commit

Permalink
Merge pull request #2560 from aleksandrychev/ENT-7664
Browse files Browse the repository at this point in the history
Added inventoryFile parameter to the Hosts by class API documentation
  • Loading branch information
nickanderson committed Nov 12, 2021
2 parents 1200449 + ee3f506 commit d7e501d
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions reference/enterprise-api-ref/host.markdown
Expand Up @@ -154,6 +154,8 @@ and resume being collected from after being deleted.
Output format. Default value is `json`. Allowed values: `json`, `yaml`.
* **withInventory** *(boolean)*
Include inventory data to the API response. Default value is `false`. Allowed values: `true`, `false`
* **inventoryFile** *(boolean)*
Make hosts' children values objects which aligns with Ansible inventory that is sourced from a file (so this format is appropriate for caching responses), wby default when `inventoryFile` is `false`, the output format aligns with Ansible inventory sourced from a script. Default value is `false`. Allowed values: `true`, `false`

**CURL unfiltered request example**

Expand Down Expand Up @@ -183,6 +185,34 @@ curl -k --user admin:admin -X GET https://hub.example.com/api/hosts/by-class
}
```

**inventoryFile=true**

```
curl -k --user admin:admin -X GET https://hub.example.com/api/hosts/by-class?inventoryFile=true
```

**Example response:**

```
{
"10_0_2_15": {
"hosts": [
"ubuntu-xenial": {}
]
},
"127_0_0_1": {
"hosts": [
"ubuntu-xenial": {}
]
},
"ubuntu_16": {
"hosts": [
"ubuntu-xenial": {}
]
}
}
```

**CURL request with inventory data example**

```
Expand Down Expand Up @@ -440,3 +470,6 @@ HTTP 200 Ok
* **count**
The bootstrapped hosts to the hub count.

## History

* `inventoryFile=true` parameter added in CFEngine 3.19.0, 3.18.1

0 comments on commit d7e501d

Please sign in to comment.