Skip to main content

Get

Show one method of an endpoint group: its route, fields, output, examples and errors.

Each input field shows where the request carries it: the path, the query, a form or the body. --json has the JSON Schema of the input and the output. osapi dsl behavior method get shows a method of a behavior the same way.

osapi dsl endpoint method get [flags]

Examples​

osapi dsl endpoint method get --name agent --method drain
osapi dsl endpoint method get --name agent --method drain --json

Result​

The command prints:

$ osapi dsl endpoint method get --name agent --method drain
Method:
  Name:          drain
  Description:   Drain an agent
  HTTP:          POST
  Route:         /api/agent/{hostname}/drain
  Keys:
  Permission:    agent:write
  Admin only:    yes
  Operation ID:  DrainAgent
  Command:       osapi client agent drain
  Input type:    DrainInput
  Output type:   none: it answers with no body
  Refuses:       a hostname over 255 characters

Input (1):
  FIELD     IN    TYPE    REQUIRED  CONSTRAINTS                   DESCRIPTION
  hostname  path  string  yes       min length 1, max length 255  The hostname of the agent to drain.

Output (0):
  None.

Examples (1):
  FLAGS
  --hostname web-01

Errors (2):
  CODE  REASON     DOC
  404   not_found  Agent not found.
  409   conflict   Agent already in requested state.

With --json, the command prints:

{
"name": "drain",
"doc": "Drain an agent",
"http_method": "POST",
"route": "/api/agent/{hostname}/drain",
"keys": null,
"permission": "agent:write",
"admin_only": true,
"operation_id": "DrainAgent",
"command": "osapi client agent drain",
"input_type": "DrainInput",
"output_type": "",
"fields": [
{
"field": "hostname",
"in": "path",
"type": "string",
"required": true,
"constraints": "min length 1, max length 255",
"description": "The hostname of the agent to drain."
}
],
"results": [],
"examples": [
{
"flags": "--hostname web-01",
"doc": ""
}
],
"refuses": ["a hostname over 255 characters"],
"errors": [
{
"code": 404,
"reason": "not_found",
"doc": "Agent not found."
},
{
"code": 409,
"reason": "conflict",
"doc": "Agent already in requested state."
}
],
"input": null,
"output": null
}

Flags​

FlagDescriptionDefault
--methodThe method, from osapi dsl endpoint get (required)
--nameThe endpoint group, such as agent (required)

Global flags​

FlagDescriptionDefault
-d, --debugEnable or disable debug mode
-j, --jsonEnable JSON output
-f, --osapi-filePath to config file; without one at the default path, osapi runs on the defaults/etc/osapi/osapi.yaml

Output tells how the result is printed, and what --json gives.