2017-05-26 23:17:59 +00:00
---
layout: api
page_title: Validate - HTTP API
2020-02-06 23:45:31 +00:00
sidebar_title: Validate
2017-05-26 23:17:59 +00:00
description: |-
The /validate endpoints are used to validate object structs, fields, and
types.
---
# Validate HTTP API
The `/validate` endpoints are used to validate object structs, fields, and
types.
## Validate Job
This endpoint validates a Nomad job file. The local Nomad agent forwards the
request to a server. In the event a server can't be reached the agent verifies
the job file locally but skips validating driver configurations.
~> This endpoint accepts a **JSON job file**, not an HCL job file.
2020-02-06 23:45:31 +00:00
| Method | Path | Produces |
| ------ | ------------------ | ------------------ |
| `POST` | `/v1/validate/job` | `application/json` |
2017-05-26 23:17:59 +00:00
The table below shows this endpoint's support for
2020-03-20 22:24:56 +00:00
[blocking queries](/api-docs#blocking-queries) and
[required ACLs](/api-docs#acls).
2017-05-26 23:17:59 +00:00
2020-02-06 23:45:31 +00:00
| Blocking Queries | ACL Required |
| ---------------- | -------------------- |
| `NO` | `namespace:read-job` |
2017-05-26 23:17:59 +00:00
### Parameters
There are no parameters, but the request _body_ contains the entire job file.
### Sample Payload
```text
(any valid nomad job IN JSON FORMAT)
```
### Sample Request
2020-05-18 20:53:06 +00:00
```shell-session
$ curl \
2017-05-26 23:17:59 +00:00
--request POST \
--data @my-job.nomad \
2018-01-29 16:27:52 +00:00
https://localhost:4646/v1/validate/job
2017-05-26 23:17:59 +00:00
```
### Sample Response
2020-02-06 23:45:31 +00:00
2017-05-26 23:17:59 +00:00
```json
{
"DriverConfigValidated": true,
"ValidationErrors": [
"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"
],
2017-07-26 00:18:15 +00:00
"Warnings": "1 warning(s):\n\n* Group \"cache\" has warnings: 1 error(s) occurred:\n\n* Update max parallel count is greater than task group count (13 > 1). A destructive change would result in the simultaneous replacement of all allocations.",
2017-05-26 23:17:59 +00:00
"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"
}
```