github.com/hhrutter/nomad@v0.6.0-rc2.0.20170723054333-80c4b03f0705/website/source/api/validate.html.md (about)

     1  ---
     2  layout: api
     3  page_title: Validate - HTTP API
     4  sidebar_current: api-validate
     5  description: |-
     6    The /validate endpoints are used to validate object structs, fields, and
     7    types.
     8  ---
     9  
    10  # Validate HTTP API
    11  
    12  The `/validate` endpoints are used to validate object structs, fields, and
    13  types.
    14  
    15  ## Validate Job
    16  
    17  This endpoint validates a Nomad job file. The local Nomad agent forwards the
    18  request to a server. In the event a server can't be reached the agent verifies
    19  the job file locally but skips validating driver configurations.
    20  
    21  ~> This endpoint accepts a **JSON job file**, not an HCL job file.
    22  
    23  | Method  | Path                      | Produces                   |
    24  | ------- | ------------------------- | -------------------------- |
    25  | `POST`  | `/v1/validate/job`        | `application/json`         |
    26  
    27  The table below shows this endpoint's support for
    28  [blocking queries](/api/index.html#blocking-queries) and
    29  [required ACLs](/api/index.html#acls).
    30  
    31  | Blocking Queries | ACL Required |
    32  | ---------------- | ------------ |
    33  | `NO`             | `none`       |
    34  
    35  ### Parameters
    36  
    37  There are no parameters, but the request _body_ contains the entire job file.
    38  
    39  ### Sample Payload
    40  
    41  ```text
    42  (any valid nomad job IN JSON FORMAT)
    43  ```
    44  
    45  ### Sample Request
    46  
    47  ```text
    48  $ curl \
    49      --request POST \
    50      --data @my-job.nomad \
    51      https://nomad.rocks/v1/validate/job
    52  ```
    53  
    54  ### Sample Response
    55  ```json
    56  {
    57    "DriverConfigValidated": true,
    58    "ValidationErrors": [
    59      "Task group cache validation failed: 1 error(s) occurred:\n\n* Task redis validation failed: 1 error(s) occurred:\n\n* 1 error(s) occurred:\n\n* minimum CPU value is 20; got 1"
    60    ],
    61    "Error": "1 error(s) occurred:\n\n* Task group cache validation failed: 1 error(s) occurred:\n\n* Task redis validation failed: 1 error(s) occurred:\n\n* 1 error(s) occurred:\n\n* minimum CPU value is 20; got 1"
    62  }
    63  ```