2015-09-20 23:52:08 +00:00
|
|
|
---
|
|
|
|
layout: "http"
|
|
|
|
page_title: "HTTP API: /v1/jobs"
|
|
|
|
sidebar_current: "docs-http-jobs"
|
|
|
|
description: |-
|
|
|
|
The '/1/jobs' endpoint is used list jobs and register new ones.
|
|
|
|
---
|
|
|
|
|
|
|
|
# /v1/jobs
|
|
|
|
|
|
|
|
The `jobs` endpoint is used to query the status of existing jobs in Nomad
|
|
|
|
and to to register new jobs. By default, the agent's local region is used;
|
|
|
|
another region can be specified using the `?region=` query parameter.
|
|
|
|
|
|
|
|
## GET
|
|
|
|
|
|
|
|
<dl>
|
|
|
|
<dt>Description</dt>
|
|
|
|
<dd>
|
|
|
|
Lists all the jobs registered with Nomad.
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Method</dt>
|
|
|
|
<dd>GET</dd>
|
|
|
|
|
|
|
|
<dt>URL</dt>
|
|
|
|
<dd>`/v1/jobs`</dd>
|
|
|
|
|
|
|
|
<dt>Parameters</dt>
|
|
|
|
<dd>
|
|
|
|
None
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Returns</dt>
|
|
|
|
<dd>
|
|
|
|
|
|
|
|
```javascript
|
2015-09-21 00:38:37 +00:00
|
|
|
[
|
2015-09-20 23:52:08 +00:00
|
|
|
{
|
2015-09-21 00:38:37 +00:00
|
|
|
"ID": "binstore-storagelocker",
|
|
|
|
"Name": "binstore-storagelocker",
|
|
|
|
"Type": "service",
|
|
|
|
"Priority": 50,
|
|
|
|
"Status": "",
|
|
|
|
"StatusDescription": "",
|
|
|
|
"CreateIndex": 14,
|
|
|
|
"ModifyIndex": 14
|
|
|
|
},
|
|
|
|
...
|
|
|
|
]
|
2015-09-20 23:52:08 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
|
|
|
|
## PUT / POST
|
|
|
|
|
|
|
|
<dl>
|
|
|
|
<dt>Description</dt>
|
|
|
|
<dd>
|
2015-09-21 00:38:37 +00:00
|
|
|
Registers a new job.
|
2015-09-20 23:52:08 +00:00
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Method</dt>
|
|
|
|
<dd>PUT or POST</dd>
|
|
|
|
|
|
|
|
<dt>URL</dt>
|
|
|
|
<dd>`/v1/jobs`</dd>
|
|
|
|
|
|
|
|
<dt>Parameters</dt>
|
|
|
|
<dd>
|
|
|
|
<ul>
|
|
|
|
<li>
|
2015-09-21 00:38:37 +00:00
|
|
|
<span class="param">Job</span>
|
2015-09-20 23:52:08 +00:00
|
|
|
<span class="param-flags">required</span>
|
2015-09-21 00:38:37 +00:00
|
|
|
The JSON definition of the job. The general structure is given
|
|
|
|
by the [job specification](/docs/jobspec/index.html), and matches
|
|
|
|
the return response of [GET against `/v1/job/<ID>`](/docs/http/job.html).
|
2015-09-20 23:52:08 +00:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Returns</dt>
|
2015-09-21 00:38:37 +00:00
|
|
|
<dd>
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"EvalID": "d092fdc0-e1fd-2536-67d8-43af8ca798ac",
|
|
|
|
"EvalCreateIndex": 35,
|
|
|
|
"JobModifyIndex": 34,
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-09-20 23:52:08 +00:00
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
|