open-nomad/website/source/docs/http/jobs.html.md

1.7 KiB

layout page_title sidebar_current description
http HTTP API: /v1/jobs docs-http-jobs 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

Description
Lists all the jobs registered with Nomad.
Method
GET
URL
`/v1/jobs`
Parameters
None
Returns
```javascript
[
{
    "ID": "binstore-storagelocker",
    "Name": "binstore-storagelocker",
    "Type": "service",
    "Priority": 50,
    "Status": "",
    "StatusDescription": "",
    "CreateIndex": 14,
    "ModifyIndex": 14
},
...
]
```

PUT / POST

Description
Registers a new job.
Method
PUT or POST
URL
`/v1/jobs`
Parameters
  • Job required 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/`](/docs/http/job.html).
Returns
```javascript
{
"EvalID": "d092fdc0-e1fd-2536-67d8-43af8ca798ac",
"EvalCreateIndex": 35,
"JobModifyIndex": 34,
}
```