github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/api-docs/jobs.mdx (about)

     1  ---
     2  layout: api
     3  page_title: Jobs - HTTP API
     4  description: The /jobs endpoints are used to query for and interact with jobs.
     5  ---
     6  
     7  # Jobs HTTP API
     8  
     9  The `/jobs` endpoints are used to query for and interact with jobs.
    10  
    11  ## List Jobs
    12  
    13  This endpoint lists all known jobs in the system registered with Nomad.
    14  
    15  | Method | Path       | Produces           |
    16  | ------ | ---------- | ------------------ |
    17  | `GET`  | `/v1/jobs` | `application/json` |
    18  
    19  The table below shows this endpoint's support for
    20  [blocking queries](/api-docs#blocking-queries) and
    21  [required ACLs](/api-docs#acls).
    22  
    23  | Blocking Queries | ACL Required          |
    24  | ---------------- | --------------------- |
    25  | `YES`            | `namespace:list-jobs` |
    26  
    27  ### Parameters
    28  
    29  - `prefix` `(string: "")` - Specifies a string to filter jobs on based on
    30    an index prefix. This is specified as a query string parameter.
    31  
    32  - `next_token` `(string: "")` - This endpoint supports paging. The `next_token`
    33    parameter accepts a string which identifies the next expected job. This value
    34    can be obtained from the `X-Nomad-NextToken` header from the previous
    35    response.
    36  
    37  - `per_page` `(int: 0)` - Specifies a maximum number of jobs to return for this
    38    request. If omitted, the response is not paginated. The value of the
    39    `X-Nomad-NextToken` header of the last response can be used as the
    40    `next_token` of the next request to fetch additional pages.
    41  
    42  - `filter` `(string: "")` - Specifies the [expression](/api-docs#filtering)
    43    used to filter the results. Consider using pagination or a query parameter to
    44    reduce resource used to serve the request.
    45  
    46  - `namespace` `(string: "default")` - Specifies the target namespace. Specifying
    47    `*` would return all jobs across all the authorized namespaces.
    48  
    49  - `meta` `(bool: false)` - If set, jobs returned will include a [meta](/docs/job-specification/meta) field containing key-value pairs provided in the job specification's `meta` block.
    50  
    51  ### Sample Request
    52  
    53  ```shell-session
    54  $ curl https://localhost:4646/v1/jobs
    55  ```
    56  
    57  ```shell-session
    58  $ curl https://localhost:4646/v1/jobs?prefix=team
    59  ```
    60  
    61  ```shell-session
    62  $ curl https://localhost:4646/v1/jobs?namespace=*&prefix=team
    63  ```
    64  
    65  ### Sample Response
    66  
    67  ```json
    68  [
    69    {
    70      "ID": "example",
    71      "ParentID": "",
    72      "Name": "example",
    73      "Type": "service",
    74      "Priority": 50,
    75      "Status": "pending",
    76      "StatusDescription": "",
    77      "JobSummary": {
    78        "JobID": "example",
    79        "Namespace": "default",
    80        "Summary": {
    81          "cache": {
    82            "Queued": 1,
    83            "Complete": 1,
    84            "Failed": 0,
    85            "Running": 0,
    86            "Starting": 0,
    87            "Lost": 0
    88          }
    89        },
    90        "Children": {
    91          "Pending": 0,
    92          "Running": 0,
    93          "Dead": 0
    94        },
    95        "CreateIndex": 52,
    96        "ModifyIndex": 96
    97      },
    98      "CreateIndex": 52,
    99      "ModifyIndex": 93,
   100      "JobModifyIndex": 52
   101    }
   102  ]
   103  ```
   104  
   105  ## Create Job
   106  
   107  This endpoint creates (aka "registers") a new job in the system.
   108  
   109  | Method | Path       | Produces           |
   110  | ------ | ---------- | ------------------ |
   111  | `POST` | `/v1/jobs` | `application/json` |
   112  
   113  The table below shows this endpoint's support for
   114  [blocking queries](/api-docs#blocking-queries) and
   115  [required ACLs](/api-docs#acls).
   116  
   117  | Blocking Queries | ACL Required                                                                      |
   118  | ---------------- | --------------------------------------------------------------------------------- |
   119  | `NO`             | `namespace:submit-job`<br />`namespace:sentinel-override` if `PolicyOverride` set |
   120  
   121  ### Parameters
   122  
   123  - `Job` `(Job: <required>)` - Specifies the JSON definition of the job.
   124  
   125  - `EnforceIndex` `(bool: false)` - If set, the job will only be registered if the
   126    passed `JobModifyIndex` matches the current job's index. If the index is zero,
   127    the register only occurs if the job is new. This paradigm allows check-and-set
   128    style job updating.
   129  
   130  - `EvalPriority` `(int: 0)` - Override the priority of the evaluations produced
   131    as a result of this job registration. By default, this is set to the priority
   132    of the job.
   133  
   134  - `JobModifyIndex` `(int: 0)` - Specifies the `JobModifyIndex` to enforce the
   135    current job is at.
   136  
   137  - `PolicyOverride` `(bool: false)` - If set, any soft mandatory Sentinel
   138    policies will be overridden. This allows a job to be registered when it would
   139    be denied by policy.
   140  
   141  - `PreserveCounts` `(bool: false)` - If set, existing task group counts are
   142    preserved, over those specified in the new job spec.
   143  
   144  ### Sample Payload
   145  
   146  ```json
   147  {
   148    "Job": {
   149      "Datacenters": ["dc1"],
   150      "ID": "cache",
   151      "TaskGroups": [
   152        {
   153          "Name": "cache",
   154          "Networks": [
   155            {
   156              "DynamicPorts": [
   157                {
   158                  "Label": "db",
   159                  "To": 6379
   160                }
   161              ]
   162            }
   163          ],
   164          "Services": [
   165            {
   166              "Name": "redis-cache",
   167              "PortLabel": "db"
   168            }
   169          ],
   170          "Tasks": [
   171            {
   172              "Config": {
   173                "image": "redis:7",
   174                "ports": ["db"]
   175              },
   176              "Driver": "docker",
   177              "Name": "redis"
   178            }
   179          ]
   180        }
   181      ]
   182    }
   183  }
   184  ```
   185  
   186  ### Sample Request
   187  
   188  ```shell-session
   189  $ curl \
   190      --request POST \
   191      --data @payload.json \
   192      https://localhost:4646/v1/jobs
   193  ```
   194  
   195  ### Sample Response
   196  
   197  ```json
   198  {
   199    "EvalID": "",
   200    "EvalCreateIndex": 0,
   201    "JobModifyIndex": 109,
   202    "Warnings": "",
   203    "Index": 0,
   204    "LastContact": 0,
   205    "KnownLeader": false
   206  }
   207  ```
   208  
   209  ## Parse Job
   210  
   211  This endpoint will parse a HCL jobspec and produce the equivalent JSON encoded
   212  job.
   213  
   214  | Method | Path             | Produces           |
   215  | ------ | ---------------- | ------------------ |
   216  | `POST` | `/v1/jobs/parse` | `application/json` |
   217  
   218  The table below shows this endpoint's support for
   219  [blocking queries](/api-docs#blocking-queries) and
   220  [required ACLs](/api-docs#acls).
   221  
   222  | Blocking Queries | ACL Required                                      |
   223  | ---------------- | ------------------------------------------------- |
   224  | `NO`             | `namespace:parse-job`<br />`namespace:submit-job` |
   225  
   226  ### Parameters
   227  
   228  - `namespace` `(string: "default")` - Specifies the target namespace. If ACL is
   229    enabled, this value must match a namespace that the token is allowed to
   230    access. This is specified as a query string parameter.
   231  
   232  - `JobHCL` `(string: <required>)` - Specifies the HCL definition of the job
   233    encoded in a JSON string.
   234  
   235  - `Canonicalize` `(bool: false)` - Flag to enable setting any unset fields to
   236    their default values.
   237  
   238  - `HCLv1` `(bool: false)` - Use the legacy v1 HCL parser.
   239  
   240  ## Sample Payload
   241  
   242  ```json
   243  {
   244    "JobHCL": "job \"example\" {\n  type = \"service\"\n  group \"cache\" {}\n}",
   245    "Canonicalize": true
   246  }
   247  ```
   248  
   249  You can use a tool such as [`jq`](https://stedolan.github.io/jq/) to generate
   250  the payload from a local HCL file:
   251  
   252  ```shell-session
   253  $ jq -Rsc '{ JobHCL: ., Canonicalize: true }' example.nomad > payload.json
   254  ```
   255  
   256  ### Sample Request
   257  
   258  ```shell-session
   259  $ curl \
   260      --request POST \
   261      --data @payload.json \
   262      https://localhost:4646/v1/jobs/parse
   263  ```
   264  
   265  ### Sample Response
   266  
   267  ```json
   268  {
   269    "AllAtOnce": false,
   270    "Constraints": null,
   271    "Affinities": null,
   272    "CreateIndex": 0,
   273    "Datacenters": null,
   274    "ID": "my-job",
   275    "JobModifyIndex": 0,
   276    "Meta": null,
   277    "Migrate": null,
   278    "ModifyIndex": 0,
   279    "Name": "my-job",
   280    "Namespace": "default",
   281    "ParameterizedJob": null,
   282    "ParentID": "",
   283    "Payload": null,
   284    "Periodic": null,
   285    "Priority": 50,
   286    "Region": "global",
   287    "Reschedule": null,
   288    "Stable": false,
   289    "Status": "",
   290    "StatusDescription": "",
   291    "Stop": false,
   292    "SubmitTime": null,
   293    "TaskGroups": null,
   294    "Type": "service",
   295    "Update": null,
   296    "VaultToken": "",
   297    "Version": 0
   298  }
   299  ```
   300  
   301  ## Read Job
   302  
   303  This endpoint reads information about a single job for its specification and
   304  status.
   305  
   306  | Method | Path              | Produces           |
   307  | ------ | ----------------- | ------------------ |
   308  | `GET`  | `/v1/job/:job_id` | `application/json` |
   309  
   310  The table below shows this endpoint's support for
   311  [blocking queries](/api-docs#blocking-queries) and
   312  [required ACLs](/api-docs#acls).
   313  
   314  | Blocking Queries | ACL Required         |
   315  | ---------------- | -------------------- |
   316  | `YES`            | `namespace:read-job` |
   317  
   318  ### Parameters
   319  
   320  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
   321    the job file during submission). This is specified as part of the path.
   322  - `namespace` `(string: "default")` - Specifies the namespace of the job. If not specified,
   323    defaults to "default". This is specified as a URL query parameter.
   324  
   325  ### Sample Request
   326  
   327  ```shell-session
   328  $ curl \
   329      https://localhost:4646/v1/job/my-job
   330  ```
   331  
   332  ```shell-session
   333  $ curl \
   334      https://localhost:4646/v1/job/my-job?namespace=apps
   335  ```
   336  
   337  ### Sample Response
   338  
   339  ```json
   340  {
   341    "Region": "global",
   342    "Namespace": "apps",
   343    "ID": "example",
   344    "ParentID": "",
   345    "Name": "example",
   346    "Type": "batch",
   347    "Priority": 50,
   348    "AllAtOnce": false,
   349    "Datacenters": ["dc1"],
   350    "Constraints": [
   351      {
   352        "LTarget": "${attr.kernel.name}",
   353        "RTarget": "linux",
   354        "Operand": "="
   355      }
   356    ],
   357    "TaskGroups": [
   358      {
   359        "Name": "cache",
   360        "Count": 1,
   361        "Constraints": [
   362          {
   363            "LTarget": "${attr.os.signals}",
   364            "RTarget": "SIGUSR1",
   365            "Operand": "set_contains"
   366          }
   367        ],
   368        "Affinities": [
   369          {
   370            "LTarget": "${meta.datacenter}",
   371            "RTarget": "dc1",
   372            "Operand": "=",
   373            "Weight": 50
   374          }
   375        ],
   376        "RestartPolicy": {
   377          "Attempts": 10,
   378          "Interval": 300000000000,
   379          "Delay": 25000000000,
   380          "Mode": "delay"
   381        },
   382        "Tasks": [
   383          {
   384            "Config": {
   385              "command": "env",
   386              "image": "alpine"
   387            },
   388            "Driver": "docker",
   389            "Lifecycle": {
   390              "Hook": "prestart",
   391              "Sidecar": false
   392            },
   393            "Name": "init",
   394            "Resources": {
   395              "CPU": 100,
   396              "MemoryMB": 300
   397            }
   398          },
   399          {
   400            "Name": "redis",
   401            "Driver": "docker",
   402            "User": "foo-user",
   403            "Config": {
   404              "image": "redis:latest",
   405              "port_map": [
   406                {
   407                  "db": 6379
   408                }
   409              ]
   410            },
   411            "Env": {
   412              "foo": "bar",
   413              "baz": "pipe"
   414            },
   415            "Services": [
   416              {
   417                "Name": "cache-redis",
   418                "PortLabel": "db",
   419                "Tags": ["global", "cache"],
   420                "Checks": [
   421                  {
   422                    "Name": "alive",
   423                    "Type": "tcp",
   424                    "Command": "",
   425                    "Args": null,
   426                    "Path": "",
   427                    "Protocol": "",
   428                    "PortLabel": "",
   429                    "Interval": 10000000000,
   430                    "Timeout": 2000000000,
   431                    "InitialStatus": ""
   432                  }
   433                ]
   434              }
   435            ],
   436            "Vault": null,
   437            "Templates": [
   438              {
   439                "SourcePath": "local/config.conf.tpl",
   440                "DestPath": "local/config.conf",
   441                "EmbeddedTmpl": "",
   442                "ChangeMode": "signal",
   443                "ChangeSignal": "SIGUSR1",
   444                "Splay": 5000000000,
   445                "Perms": ""
   446              }
   447            ],
   448            "Constraints": null,
   449            "Affinities": null,
   450            "Resources": {
   451              "CPU": 500,
   452              "MemoryMB": 256,
   453              "DiskMB": 0,
   454              "Networks": [
   455                {
   456                  "Device": "",
   457                  "CIDR": "",
   458                  "IP": "",
   459                  "MBits": 10,
   460                  "ReservedPorts": [
   461                    {
   462                      "Label": "rpc",
   463                      "Value": 25566
   464                    }
   465                  ],
   466                  "DynamicPorts": [
   467                    {
   468                      "Label": "db",
   469                      "Value": 0
   470                    }
   471                  ]
   472                }
   473              ]
   474            },
   475            "DispatchPayload": {
   476              "File": "config.json"
   477            },
   478            "Meta": {
   479              "foo": "bar",
   480              "baz": "pipe"
   481            },
   482            "KillTimeout": 5000000000,
   483            "LogConfig": {
   484              "MaxFiles": 10,
   485              "MaxFileSizeMB": 10
   486            },
   487            "Artifacts": [
   488              {
   489                "GetterSource": "http://foo.com/artifact.tar.gz",
   490                "GetterOptions": {
   491                  "checksum": "md5:c4aa853ad2215426eb7d70a21922e794"
   492                },
   493                "RelativeDest": "local/"
   494              }
   495            ],
   496            "Leader": false
   497          }
   498        ],
   499        "EphemeralDisk": {
   500          "Sticky": false,
   501          "SizeMB": 300,
   502          "Migrate": false
   503        },
   504        "Meta": {
   505          "foo": "bar",
   506          "baz": "pipe"
   507        }
   508      }
   509    ],
   510    "Update": {
   511      "Stagger": 10000000000,
   512      "MaxParallel": 1
   513    },
   514    "Periodic": {
   515      "Enabled": true,
   516      "Spec": "* * * * *",
   517      "SpecType": "cron",
   518      "ProhibitOverlap": true
   519    },
   520    "ParameterizedJob": {
   521      "Payload": "required",
   522      "MetaRequired": ["foo"],
   523      "MetaOptional": ["bar"]
   524    },
   525    "Payload": null,
   526    "Meta": {
   527      "foo": "bar",
   528      "baz": "pipe"
   529    },
   530    "VaultToken": "",
   531    "Status": "running",
   532    "StatusDescription": "",
   533    "CreateIndex": 7,
   534    "ModifyIndex": 7,
   535    "JobModifyIndex": 7
   536  }
   537  ```
   538  
   539  #### Field Reference
   540  
   541  - `Status`: The job's current state. It can have one of the following values:
   542    - `pending`: The job is currently waiting on scheduling.
   543    - `running`: The job has non-terminal allocations.
   544    - `dead`: All of the job's allocations and evaluations are terminal.
   545  - `Type`: The type of job in terms of scheduling. It can have one of the following values:
   546    - `service`: Allocations are intended to remain alive.
   547    - `batch`: Allocations are intended to exit.
   548    - `system`: Each client gets an allocation.
   549  
   550  ## List Job Versions
   551  
   552  This endpoint reads information about all versions of a job.
   553  
   554  | Method | Path                       | Produces           |
   555  | ------ | -------------------------- | ------------------ |
   556  | `GET`  | `/v1/job/:job_id/versions` | `application/json` |
   557  
   558  The table below shows this endpoint's support for
   559  [blocking queries](/api-docs#blocking-queries) and
   560  [required ACLs](/api-docs#acls).
   561  
   562  | Blocking Queries | ACL Required         |
   563  | ---------------- | -------------------- |
   564  | `YES`            | `namespace:read-job` |
   565  
   566  ### Parameters
   567  
   568  - `diffs` `(bool: false)` - Specifies if the Diffs field should be populated,
   569    containing the structured diff between the current and last job version.
   570  
   571  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
   572    the job file during submission). This is specified as part of the path.
   573  
   574  ### Sample Request
   575  
   576  ```shell-session
   577  $ curl \
   578      https://localhost:4646/v1/job/my-job/versions
   579  ```
   580  
   581  ### Sample Response
   582  
   583  ```json
   584  {
   585    "Diffs": null,
   586    "Index": 51,
   587    "KnownLeader": true,
   588    "LastContact": 0,
   589    "Versions": [
   590      {
   591        "Affinities": null,
   592        "AllAtOnce": false,
   593        "Constraints": null,
   594        "ConsulToken": "",
   595        "CreateIndex": 44,
   596        "Datacenters": ["dc1"],
   597        "Dispatched": false,
   598        "ID": "example",
   599        "JobModifyIndex": 44,
   600        "Meta": null,
   601        "ModifyIndex": 51,
   602        "Multiregion": null,
   603        "Name": "example",
   604        "Namespace": "default",
   605        "NomadTokenID": "",
   606        "ParameterizedJob": null,
   607        "ParentID": "",
   608        "Payload": null,
   609        "Periodic": null,
   610        "Priority": 50,
   611        "Region": "global",
   612        "Spreads": null,
   613        "Stable": true,
   614        "Status": "running",
   615        "StatusDescription": "",
   616        "Stop": false,
   617        "SubmitTime": 1608304897537638400,
   618        "TaskGroups": [
   619          {
   620            "Affinities": null,
   621            "Constraints": null,
   622            "Count": 1,
   623            "EphemeralDisk": {
   624              "Migrate": false,
   625              "SizeMB": 300,
   626              "Sticky": false
   627            },
   628            "MaxClientDisconnect": 300000000000,
   629            "Meta": null,
   630            "Migrate": {
   631              "HealthCheck": "checks",
   632              "HealthyDeadline": 300000000000,
   633              "MaxParallel": 1,
   634              "MinHealthyTime": 10000000000
   635            },
   636            "Name": "cache",
   637            "Networks": [
   638              {
   639                "CIDR": "",
   640                "DNS": null,
   641                "Device": "",
   642                "DynamicPorts": [
   643                  {
   644                    "HostNetwork": "default",
   645                    "Label": "db",
   646                    "To": 6379,
   647                    "Value": 0
   648                  }
   649                ],
   650                "IP": "",
   651                "MBits": 0,
   652                "Mode": "",
   653                "ReservedPorts": null
   654              }
   655            ],
   656            "ReschedulePolicy": {
   657              "Attempts": 0,
   658              "Delay": 30000000000,
   659              "DelayFunction": "exponential",
   660              "Interval": 0,
   661              "MaxDelay": 3600000000000,
   662              "Unlimited": true
   663            },
   664            "RestartPolicy": {
   665              "Attempts": 2,
   666              "Delay": 15000000000,
   667              "Interval": 1800000000000,
   668              "Mode": "fail"
   669            },
   670            "Scaling": null,
   671            "Services": null,
   672            "ShutdownDelay": null,
   673            "Spreads": null,
   674            "StopAfterClientDisconnect": null,
   675            "Tasks": [
   676              {
   677                "Affinities": null,
   678                "Artifacts": null,
   679                "CSIPluginConfig": null,
   680                "Config": {
   681                  "image": "redis:7",
   682                  "ports": ["db"]
   683                },
   684                "Constraints": null,
   685                "DispatchPayload": null,
   686                "Driver": "docker",
   687                "Env": null,
   688                "KillSignal": "",
   689                "KillTimeout": 5000000000,
   690                "Kind": "",
   691                "Leader": false,
   692                "Lifecycle": null,
   693                "LogConfig": {
   694                  "MaxFileSizeMB": 10,
   695                  "MaxFiles": 10
   696                },
   697                "Meta": null,
   698                "Name": "redis",
   699                "Resources": {
   700                  "CPU": 500,
   701                  "Devices": null,
   702                  "DiskMB": 0,
   703                  "IOPS": 0,
   704                  "MemoryMB": 256,
   705                  "Networks": null
   706                },
   707                "RestartPolicy": {
   708                  "Attempts": 2,
   709                  "Delay": 15000000000,
   710                  "Interval": 1800000000000,
   711                  "Mode": "fail"
   712                },
   713                "ScalingPolicies": null,
   714                "Services": null,
   715                "ShutdownDelay": 0,
   716                "Templates": null,
   717                "User": "",
   718                "Vault": null,
   719                "VolumeMounts": null
   720              }
   721            ],
   722            "Update": {
   723              "AutoPromote": false,
   724              "AutoRevert": false,
   725              "Canary": 0,
   726              "HealthCheck": "checks",
   727              "HealthyDeadline": 300000000000,
   728              "MaxParallel": 1,
   729              "MinHealthyTime": 10000000000,
   730              "ProgressDeadline": 600000000000,
   731              "Stagger": 30000000000
   732            },
   733            "Volumes": null
   734          }
   735        ],
   736        "Type": "service",
   737        "Update": {
   738          "AutoPromote": false,
   739          "AutoRevert": false,
   740          "Canary": 0,
   741          "HealthCheck": "",
   742          "HealthyDeadline": 0,
   743          "MaxParallel": 1,
   744          "MinHealthyTime": 0,
   745          "ProgressDeadline": 0,
   746          "Stagger": 30000000000
   747        },
   748        "VaultNamespace": "",
   749        "VaultToken": "",
   750        "Version": 0
   751      }
   752    ]
   753  }
   754  ```
   755  
   756  ```shell-session
   757  $ curl \
   758      https://localhost:4646/v1/job/my-job/versions?diffs=true
   759  ```
   760  
   761  ```
   762  
   763  {
   764    "Diffs": [
   765      {
   766        "Fields": null,
   767        "ID": "example",
   768        "Objects": null,
   769        "TaskGroups": [
   770          {
   771            "Fields": null,
   772            "Name": "cache",
   773            "Objects": null,
   774            "Tasks": [
   775              {
   776                "Annotations": null,
   777                "Fields": [
   778                  {
   779                    "Annotations": null,
   780                    "Name": "Env[foo]",
   781                    "New": "bar",
   782                    "Old": "",
   783                    "Type": "Added"
   784                  }
   785                ],
   786                "Name": "redis",
   787                "Objects": null,
   788                "Type": "Edited"
   789              }
   790            ],
   791            "Type": "Edited",
   792            "Updates": null
   793          }
   794        ],
   795        "Type": "Edited"
   796      }
   797    ],
   798    "Index": 26,
   799    "KnownLeader": true,
   800    "LastContact": 0,
   801    "Versions": [
   802      {
   803        "Affinities": null,
   804        "AllAtOnce": false,
   805        "Constraints": null,
   806        "ConsulToken": "",
   807        "CreateIndex": 10,
   808        "Datacenters": [
   809          "dc1"
   810        ],
   811        "Dispatched": false,
   812        "ID": "example",
   813        "JobModifyIndex": 16,
   814        "Meta": null,
   815        "ModifyIndex": 26,
   816        "Multiregion": null,
   817        "Name": "example",
   818        "Namespace": "default",
   819        "NomadTokenID": "",
   820        "ParameterizedJob": null,
   821        "ParentID": "",
   822        "Payload": null,
   823        "Periodic": null,
   824        "Priority": 50,
   825        "Region": "global",
   826        "Spreads": null,
   827        "Stable": true,
   828        "Status": "running",
   829        "StatusDescription": "",
   830        "Stop": false,
   831        "SubmitTime": 1608316675000588800,
   832        "TaskGroups": [
   833          {
   834            "Affinities": null,
   835            "Constraints": null,
   836            "Count": 1,
   837            "EphemeralDisk": {
   838              "Migrate": false,
   839              "SizeMB": 300,
   840              "Sticky": false
   841            },
   842            "MaxClientDisconnect": null,
   843            "Meta": null,
   844            "Migrate": {
   845              "HealthCheck": "checks",
   846              "HealthyDeadline": 300000000000,
   847              "MaxParallel": 1,
   848              "MinHealthyTime": 10000000000
   849            },
   850            "Name": "cache",
   851            "Networks": [
   852              {
   853                "CIDR": "",
   854                "DNS": null,
   855                "Device": "",
   856                "DynamicPorts": [
   857                  {
   858                    "HostNetwork": "default",
   859                    "Label": "db",
   860                    "To": 6379,
   861                    "Value": 0
   862                  }
   863                ],
   864                "IP": "",
   865                "MBits": 0,
   866                "Mode": "",
   867                "ReservedPorts": null
   868              }
   869            ],
   870            "ReschedulePolicy": {
   871              "Attempts": 0,
   872              "Delay": 30000000000,
   873              "DelayFunction": "exponential",
   874              "Interval": 0,
   875              "MaxDelay": 3600000000000,
   876              "Unlimited": true
   877            },
   878            "RestartPolicy": {
   879              "Attempts": 2,
   880              "Delay": 15000000000,
   881              "Interval": 1800000000000,
   882              "Mode": "fail"
   883            },
   884            "Scaling": null,
   885            "Services": null,
   886            "ShutdownDelay": null,
   887            "Spreads": null,
   888            "StopAfterClientDisconnect": null,
   889            "Tasks": [
   890              {
   891                "Affinities": null,
   892                "Artifacts": null,
   893                "CSIPluginConfig": null,
   894                "Config": {
   895                  "image": "redis:7",
   896                  "ports": [
   897                    "db"
   898                  ]
   899                },
   900                "Constraints": null,
   901                "DispatchPayload": null,
   902                "Driver": "docker",
   903                "Env": {
   904                  "foo": "bar"
   905                },
   906                "KillSignal": "",
   907                "KillTimeout": 5000000000,
   908                "Kind": "",
   909                "Leader": false,
   910                "Lifecycle": null,
   911                "LogConfig": {
   912                  "MaxFileSizeMB": 10,
   913                  "MaxFiles": 10
   914                },
   915                "Meta": null,
   916                "Name": "redis",
   917                "Resources": {
   918                  "CPU": 500,
   919                  "Devices": null,
   920                  "DiskMB": 0,
   921                  "IOPS": 0,
   922                  "MemoryMB": 256,
   923                  "Networks": null
   924                },
   925                "RestartPolicy": {
   926                  "Attempts": 2,
   927                  "Delay": 15000000000,
   928                  "Interval": 1800000000000,
   929                  "Mode": "fail"
   930                },
   931                "ScalingPolicies": null,
   932                "Services": null,
   933                "ShutdownDelay": 0,
   934                "Templates": null,
   935                "User": "",
   936                "Vault": null,
   937                "VolumeMounts": null
   938              }
   939            ],
   940            "Update": {
   941              "AutoPromote": false,
   942              "AutoRevert": false,
   943              "Canary": 0,
   944              "HealthCheck": "checks",
   945              "HealthyDeadline": 300000000000,
   946              "MaxParallel": 1,
   947              "MinHealthyTime": 10000000000,
   948              "ProgressDeadline": 600000000000,
   949              "Stagger": 30000000000
   950            },
   951            "Volumes": null
   952          }
   953        ],
   954        "Type": "service",
   955        "Update": {
   956          "AutoPromote": false,
   957          "AutoRevert": false,
   958          "Canary": 0,
   959          "HealthCheck": "",
   960          "HealthyDeadline": 0,
   961          "MaxParallel": 1,
   962          "MinHealthyTime": 0,
   963          "ProgressDeadline": 0,
   964          "Stagger": 30000000000
   965        },
   966        "VaultNamespace": "",
   967        "VaultToken": "",
   968        "Version": 1
   969      },
   970      {
   971        "Affinities": null,
   972        "AllAtOnce": false,
   973        "Constraints": null,
   974        "ConsulToken": "",
   975        "CreateIndex": 10,
   976        "Datacenters": [
   977          "dc1"
   978        ],
   979        "Dispatched": false,
   980        "ID": "example",
   981        "JobModifyIndex": 10,
   982        "Meta": null,
   983        "ModifyIndex": 10,
   984        "Multiregion": null,
   985        "Name": "example",
   986        "Namespace": "default",
   987        "NomadTokenID": "",
   988        "ParameterizedJob": null,
   989        "ParentID": "",
   990        "Payload": null,
   991        "Periodic": null,
   992        "Priority": 50,
   993        "Region": "global",
   994        "Spreads": null,
   995        "Stable": false,
   996        "Status": "pending",
   997        "StatusDescription": "",
   998        "Stop": false,
   999        "SubmitTime": 1608316662268190500,
  1000        "TaskGroups": [
  1001          {
  1002            "Affinities": null,
  1003            "Constraints": null,
  1004            "Count": 1,
  1005            "EphemeralDisk": {
  1006              "Migrate": false,
  1007              "SizeMB": 300,
  1008              "Sticky": false
  1009            },
  1010            "MaxClientDisconnect": null,
  1011            "Meta": null,
  1012            "Migrate": {
  1013              "HealthCheck": "checks",
  1014              "HealthyDeadline": 300000000000,
  1015              "MaxParallel": 1,
  1016              "MinHealthyTime": 10000000000
  1017            },
  1018            "Name": "cache",
  1019            "Networks": [
  1020              {
  1021                "CIDR": "",
  1022                "DNS": null,
  1023                "Device": "",
  1024                "DynamicPorts": [
  1025                  {
  1026                    "HostNetwork": "default",
  1027                    "Label": "db",
  1028                    "To": 6379,
  1029                    "Value": 0
  1030                  }
  1031                ],
  1032                "IP": "",
  1033                "MBits": 0,
  1034                "Mode": "",
  1035                "ReservedPorts": null
  1036              }
  1037            ],
  1038            "ReschedulePolicy": {
  1039              "Attempts": 0,
  1040              "Delay": 30000000000,
  1041              "DelayFunction": "exponential",
  1042              "Interval": 0,
  1043              "MaxDelay": 3600000000000,
  1044              "Unlimited": true
  1045            },
  1046            "RestartPolicy": {
  1047              "Attempts": 2,
  1048              "Delay": 15000000000,
  1049              "Interval": 1800000000000,
  1050              "Mode": "fail"
  1051            },
  1052            "Scaling": null,
  1053            "Services": null,
  1054            "ShutdownDelay": null,
  1055            "Spreads": null,
  1056            "StopAfterClientDisconnect": null,
  1057            "Tasks": [
  1058              {
  1059                "Affinities": null,
  1060                "Artifacts": null,
  1061                "CSIPluginConfig": null,
  1062                "Config": {
  1063                  "image": "redis:7",
  1064                  "ports": [
  1065                    "db"
  1066                  ]
  1067                },
  1068                "Constraints": null,
  1069                "DispatchPayload": null,
  1070                "Driver": "docker",
  1071                "Env": null,
  1072                "KillSignal": "",
  1073                "KillTimeout": 5000000000,
  1074                "Kind": "",
  1075                "Leader": false,
  1076                "Lifecycle": null,
  1077                "LogConfig": {
  1078                  "MaxFileSizeMB": 10,
  1079                  "MaxFiles": 10
  1080                },
  1081                "Meta": null,
  1082                "Name": "redis",
  1083                "Resources": {
  1084                  "CPU": 500,
  1085                  "Devices": null,
  1086                  "DiskMB": 0,
  1087                  "IOPS": 0,
  1088                  "MemoryMB": 256,
  1089                  "Networks": null
  1090                },
  1091                "RestartPolicy": {
  1092                  "Attempts": 2,
  1093                  "Delay": 15000000000,
  1094                  "Interval": 1800000000000,
  1095                  "Mode": "fail"
  1096                },
  1097                "ScalingPolicies": null,
  1098                "Services": null,
  1099                "ShutdownDelay": 0,
  1100                "Templates": null,
  1101                "User": "",
  1102                "Vault": null,
  1103                "VolumeMounts": null
  1104              }
  1105            ],
  1106            "Update": {
  1107              "AutoPromote": false,
  1108              "AutoRevert": false,
  1109              "Canary": 0,
  1110              "HealthCheck": "checks",
  1111              "HealthyDeadline": 300000000000,
  1112              "MaxParallel": 1,
  1113              "MinHealthyTime": 10000000000,
  1114              "ProgressDeadline": 600000000000,
  1115              "Stagger": 30000000000
  1116            },
  1117            "Volumes": null
  1118          }
  1119        ],
  1120        "Type": "service",
  1121        "Update": {
  1122          "AutoPromote": false,
  1123          "AutoRevert": false,
  1124          "Canary": 0,
  1125          "HealthCheck": "",
  1126          "HealthyDeadline": 0,
  1127          "MaxParallel": 1,
  1128          "MinHealthyTime": 0,
  1129          "ProgressDeadline": 0,
  1130          "Stagger": 30000000000
  1131        },
  1132        "VaultNamespace": "",
  1133        "VaultToken": "",
  1134        "Version": 0
  1135      }
  1136    ]
  1137  }
  1138  ```
  1139  
  1140  ## List Job Allocations
  1141  
  1142  This endpoint reads information about a single job's allocations.
  1143  
  1144  | Method | Path                          | Produces           |
  1145  | ------ | ----------------------------- | ------------------ |
  1146  | `GET`  | `/v1/job/:job_id/allocations` | `application/json` |
  1147  
  1148  The table below shows this endpoint's support for
  1149  [blocking queries](/api-docs#blocking-queries) and
  1150  [required ACLs](/api-docs#acls).
  1151  
  1152  | Blocking Queries | ACL Required         |
  1153  | ---------------- | -------------------- |
  1154  | `YES`            | `namespace:read-job` |
  1155  
  1156  ### Parameters
  1157  
  1158  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  1159    the job file during submission). This is specified as part of the path.
  1160  
  1161  - `all` `(bool: false)` - Specifies whether the list of allocations should
  1162    include allocations from a previously registered job with the same ID. This is
  1163    possible if the job is deregistered and reregistered.
  1164  
  1165  ### Sample Request
  1166  
  1167  ```shell-session
  1168  $ curl \
  1169      https://localhost:4646/v1/job/my-job/allocations
  1170  ```
  1171  
  1172  ### Sample Response
  1173  
  1174  ```json
  1175  [
  1176    {
  1177      "ID": "ed344e0a-7290-d117-41d3-a64f853ca3c2",
  1178      "EvalID": "a9c5effc-2242-51b2-f1fe-054ee11ab189",
  1179      "Name": "example.cache[0]",
  1180      "NodeID": "cb1f6030-a220-4f92-57dc-7baaabdc3823",
  1181      "PreviousAllocation": "516d2753-0513-cfc7-57ac-2d6fac18b9dc",
  1182      "NextAllocation": "cd13d9b9-4f97-7184-c88b-7b451981616b",
  1183      "RescheduleTracker": {
  1184        "Events": [
  1185          {
  1186            "PrevAllocID": "516d2753-0513-cfc7-57ac-2d6fac18b9dc",
  1187            "PrevNodeID": "9230cd3b-3bda-9a3f-82f9-b2ea8dedb20e",
  1188            "RescheduleTime": 1517434161192946200,
  1189            "Delay": 5000000000
  1190          }
  1191        ]
  1192      },
  1193      "JobID": "example",
  1194      "TaskGroup": "cache",
  1195      "DesiredStatus": "run",
  1196      "DesiredDescription": "",
  1197      "ClientStatus": "running",
  1198      "ClientDescription": "",
  1199      "TaskStates": {
  1200        "redis": {
  1201          "State": "running",
  1202          "Failed": false,
  1203          "StartedAt": "2017-05-25T23:41:23.240184101Z",
  1204          "FinishedAt": "0001-01-01T00:00:00Z",
  1205          "Events": [
  1206            {
  1207              "Type": "Received",
  1208              "Time": 1495755675956923000,
  1209              "FailsTask": false,
  1210              "RestartReason": "",
  1211              "SetupError": "",
  1212              "DriverError": "",
  1213              "ExitCode": 0,
  1214              "Signal": 0,
  1215              "Message": "",
  1216              "KillTimeout": 0,
  1217              "KillError": "",
  1218              "KillReason": "",
  1219              "StartDelay": 0,
  1220              "DownloadError": "",
  1221              "ValidationError": "",
  1222              "DiskLimit": 0,
  1223              "FailedSibling": "",
  1224              "VaultError": "",
  1225              "TaskSignalReason": "",
  1226              "TaskSignal": "",
  1227              "DriverMessage": ""
  1228            },
  1229            {
  1230              "Type": "Task Setup",
  1231              "Time": 1495755675957466400,
  1232              "FailsTask": false,
  1233              "RestartReason": "",
  1234              "SetupError": "",
  1235              "DriverError": "",
  1236              "ExitCode": 0,
  1237              "Signal": 0,
  1238              "Message": "Building Task Directory",
  1239              "KillTimeout": 0,
  1240              "KillError": "",
  1241              "KillReason": "",
  1242              "StartDelay": 0,
  1243              "DownloadError": "",
  1244              "ValidationError": "",
  1245              "DiskLimit": 0,
  1246              "FailedSibling": "",
  1247              "VaultError": "",
  1248              "TaskSignalReason": "",
  1249              "TaskSignal": "",
  1250              "DriverMessage": ""
  1251            },
  1252            {
  1253              "Type": "Driver",
  1254              "Time": 1495755675970286800,
  1255              "FailsTask": false,
  1256              "RestartReason": "",
  1257              "SetupError": "",
  1258              "DriverError": "",
  1259              "ExitCode": 0,
  1260              "Signal": 0,
  1261              "Message": "",
  1262              "KillTimeout": 0,
  1263              "KillError": "",
  1264              "KillReason": "",
  1265              "StartDelay": 0,
  1266              "DownloadError": "",
  1267              "ValidationError": "",
  1268              "DiskLimit": 0,
  1269              "FailedSibling": "",
  1270              "VaultError": "",
  1271              "TaskSignalReason": "",
  1272              "TaskSignal": "",
  1273              "DriverMessage": "Downloading image redis:7"
  1274            },
  1275            {
  1276              "Type": "Started",
  1277              "Time": 1495755683227522000,
  1278              "FailsTask": false,
  1279              "RestartReason": "",
  1280              "SetupError": "",
  1281              "DriverError": "",
  1282              "ExitCode": 0,
  1283              "Signal": 0,
  1284              "Message": "",
  1285              "KillTimeout": 0,
  1286              "KillError": "",
  1287              "KillReason": "",
  1288              "StartDelay": 0,
  1289              "DownloadError": "",
  1290              "ValidationError": "",
  1291              "DiskLimit": 0,
  1292              "FailedSibling": "",
  1293              "VaultError": "",
  1294              "TaskSignalReason": "",
  1295              "TaskSignal": "",
  1296              "DriverMessage": ""
  1297            }
  1298          ]
  1299        }
  1300      },
  1301      "CreateIndex": 9,
  1302      "ModifyIndex": 13,
  1303      "CreateTime": 1495755675944527600,
  1304      "ModifyTime": 1495755675944527600
  1305    }
  1306  ]
  1307  ```
  1308  
  1309  ## List Job Evaluations
  1310  
  1311  This endpoint reads information about a single job's evaluations
  1312  
  1313  | Method | Path                          | Produces           |
  1314  | ------ | ----------------------------- | ------------------ |
  1315  | `GET`  | `/v1/job/:job_id/evaluations` | `application/json` |
  1316  
  1317  The table below shows this endpoint's support for
  1318  [blocking queries](/api-docs#blocking-queries) and
  1319  [required ACLs](/api-docs#acls).
  1320  
  1321  | Blocking Queries | ACL Required         |
  1322  | ---------------- | -------------------- |
  1323  | `YES`            | `namespace:read-job` |
  1324  
  1325  ### Parameters
  1326  
  1327  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  1328    the job file during submission). This is specified as part of the path.
  1329  
  1330  ### Sample Request
  1331  
  1332  ```shell-session
  1333  $ curl \
  1334      https://localhost:4646/v1/job/my-job/evaluations
  1335  ```
  1336  
  1337  ### Sample Response
  1338  
  1339  ```json
  1340  [
  1341    {
  1342      "ID": "a9c5effc-2242-51b2-f1fe-054ee11ab189",
  1343      "Priority": 50,
  1344      "Type": "service",
  1345      "TriggeredBy": "job-register",
  1346      "JobID": "example",
  1347      "JobModifyIndex": 7,
  1348      "NodeID": "",
  1349      "NodeModifyIndex": 0,
  1350      "Status": "complete",
  1351      "StatusDescription": "",
  1352      "Wait": 0,
  1353      "NextEval": "",
  1354      "PreviousEval": "",
  1355      "BlockedEval": "",
  1356      "FailedTGAllocs": null,
  1357      "ClassEligibility": null,
  1358      "EscapedComputedClass": false,
  1359      "AnnotatePlan": false,
  1360      "QueuedAllocations": {
  1361        "cache": 0
  1362      },
  1363      "SnapshotIndex": 8,
  1364      "CreateIndex": 8,
  1365      "ModifyIndex": 10
  1366    }
  1367  ]
  1368  ```
  1369  
  1370  ## List Job Deployments
  1371  
  1372  This endpoint lists a single job's deployments
  1373  
  1374  | Method | Path                          | Produces           |
  1375  | ------ | ----------------------------- | ------------------ |
  1376  | `GET`  | `/v1/job/:job_id/deployments` | `application/json` |
  1377  
  1378  The table below shows this endpoint's support for
  1379  [blocking queries](/api-docs#blocking-queries) and
  1380  [required ACLs](/api-docs#acls).
  1381  
  1382  | Blocking Queries | ACL Required         |
  1383  | ---------------- | -------------------- |
  1384  | `YES`            | `namespace:read-job` |
  1385  
  1386  ### Parameters
  1387  
  1388  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  1389    the job file during submission). This is specified as part of the path.
  1390  
  1391  - `all` `(bool: false)` - Specifies whether the list of deployments should
  1392    include deployments from a previously registered job with the same ID. This is
  1393    possible if the job is deregistered and reregistered.
  1394  
  1395  ### Sample Request
  1396  
  1397  ```shell-session
  1398  $ curl \
  1399      https://localhost:4646/v1/job/my-job/deployments
  1400  ```
  1401  
  1402  ### Sample Response
  1403  
  1404  ```json
  1405  [
  1406    {
  1407      "ID": "85ee4a9a-339f-a921-a9ef-0550d20b2c61",
  1408      "JobID": "my-job",
  1409      "JobVersion": 1,
  1410      "JobModifyIndex": 19,
  1411      "JobCreateIndex": 7,
  1412      "TaskGroups": {
  1413        "cache": {
  1414          "AutoRevert": true,
  1415          "Promoted": false,
  1416          "PlacedCanaries": [
  1417            "d0ad0808-2765-abf6-1e15-79fb7fe5a416",
  1418            "38c70cd8-81f2-1489-a328-87bb29ec0e0f"
  1419          ],
  1420          "DesiredCanaries": 2,
  1421          "DesiredTotal": 3,
  1422          "PlacedAllocs": 2,
  1423          "HealthyAllocs": 2,
  1424          "UnhealthyAllocs": 0
  1425        }
  1426      },
  1427      "Status": "running",
  1428      "StatusDescription": "Deployment is running",
  1429      "CreateIndex": 21,
  1430      "ModifyIndex": 25
  1431    },
  1432    {
  1433      "ID": "fb6070fb-4a44-e255-4e6f-8213eba3871a",
  1434      "JobID": "my-job",
  1435      "JobVersion": 0,
  1436      "JobModifyIndex": 7,
  1437      "JobCreateIndex": 7,
  1438      "TaskGroups": {
  1439        "cache": {
  1440          "AutoRevert": true,
  1441          "Promoted": false,
  1442          "PlacedCanaries": null,
  1443          "DesiredCanaries": 0,
  1444          "DesiredTotal": 3,
  1445          "PlacedAllocs": 3,
  1446          "HealthyAllocs": 3,
  1447          "UnhealthyAllocs": 0
  1448        }
  1449      },
  1450      "Status": "successful",
  1451      "StatusDescription": "Deployment completed successfully",
  1452      "CreateIndex": 9,
  1453      "ModifyIndex": 17
  1454    }
  1455  ]
  1456  ```
  1457  
  1458  ## Read Job's Most Recent Deployment
  1459  
  1460  This endpoint returns a single job's most recent deployment.
  1461  
  1462  | Method | Path                         | Produces           |
  1463  | ------ | ---------------------------- | ------------------ |
  1464  | `GET`  | `/v1/job/:job_id/deployment` | `application/json` |
  1465  
  1466  The table below shows this endpoint's support for
  1467  [blocking queries](/api-docs#blocking-queries) and
  1468  [required ACLs](/api-docs#acls).
  1469  
  1470  | Blocking Queries | ACL Required         |
  1471  | ---------------- | -------------------- |
  1472  | `YES`            | `namespace:read-job` |
  1473  
  1474  ### Parameters
  1475  
  1476  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  1477    the job file during submission). This is specified as part of the path.
  1478  
  1479  ### Sample Request
  1480  
  1481  ```shell-session
  1482  $ curl \
  1483      https://localhost:4646/v1/job/my-job/deployment
  1484  ```
  1485  
  1486  ### Sample Response
  1487  
  1488  ```json
  1489  {
  1490    "ID": "85ee4a9a-339f-a921-a9ef-0550d20b2c61",
  1491    "JobID": "my-job",
  1492    "JobVersion": 1,
  1493    "JobModifyIndex": 19,
  1494    "JobCreateIndex": 7,
  1495    "TaskGroups": {
  1496      "cache": {
  1497        "AutoRevert": true,
  1498        "Promoted": false,
  1499        "PlacedCanaries": [
  1500          "d0ad0808-2765-abf6-1e15-79fb7fe5a416",
  1501          "38c70cd8-81f2-1489-a328-87bb29ec0e0f"
  1502        ],
  1503        "DesiredCanaries": 2,
  1504        "DesiredTotal": 3,
  1505        "PlacedAllocs": 2,
  1506        "HealthyAllocs": 2,
  1507        "UnhealthyAllocs": 0
  1508      }
  1509    },
  1510    "Status": "running",
  1511    "StatusDescription": "Deployment is running",
  1512    "CreateIndex": 21,
  1513    "ModifyIndex": 25
  1514  }
  1515  ```
  1516  
  1517  ## Read Job Summary
  1518  
  1519  This endpoint reads summary information about a job.
  1520  
  1521  | Method | Path                      | Produces           |
  1522  | ------ | ------------------------- | ------------------ |
  1523  | `GET`  | `/v1/job/:job_id/summary` | `application/json` |
  1524  
  1525  The table below shows this endpoint's support for
  1526  [blocking queries](/api-docs#blocking-queries) and
  1527  [required ACLs](/api-docs#acls).
  1528  
  1529  | Blocking Queries | ACL Required         |
  1530  | ---------------- | -------------------- |
  1531  | `YES`            | `namespace:read-job` |
  1532  
  1533  ### Parameters
  1534  
  1535  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  1536    the job file during submission). This is specified as part of the path.
  1537  
  1538  ### Sample Request
  1539  
  1540  ```shell-session
  1541  $ curl \
  1542      https://localhost:4646/v1/job/my-job/summary
  1543  ```
  1544  
  1545  ### Sample Response
  1546  
  1547  ```json
  1548  {
  1549    "JobID": "example",
  1550    "Summary": {
  1551      "cache": {
  1552        "Queued": 0,
  1553        "Complete": 0,
  1554        "Failed": 0,
  1555        "Running": 1,
  1556        "Starting": 0,
  1557        "Lost": 0
  1558      }
  1559    },
  1560    "Children": {
  1561      "Pending": 0,
  1562      "Running": 0,
  1563      "Dead": 0
  1564    },
  1565    "CreateIndex": 7,
  1566    "ModifyIndex": 13
  1567  }
  1568  ```
  1569  
  1570  ## Update Existing Job
  1571  
  1572  This endpoint registers a new job or updates an existing job.
  1573  
  1574  | Method | Path              | Produces           |
  1575  | ------ | ----------------- | ------------------ |
  1576  | `POST` | `/v1/job/:job_id` | `application/json` |
  1577  
  1578  The table below shows this endpoint's support for
  1579  [blocking queries](/api-docs#blocking-queries) and
  1580  [required ACLs](/api-docs#acls).
  1581  
  1582  | Blocking Queries | ACL Required                                                                      |
  1583  | ---------------- | --------------------------------------------------------------------------------- |
  1584  | `NO`             | `namespace:submit-job`<br />`namespace:sentinel-override` if `PolicyOverride` set |
  1585  
  1586  ### Parameters
  1587  
  1588  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  1589    the job file during submission). This is specified as part of the path.
  1590  
  1591  - `Job` `(Job: <required>)` - Specifies the JSON definition of the job.
  1592  
  1593  - `EnforceIndex` `(bool: false)` - If set, the job will only be registered if the
  1594    passed `JobModifyIndex` matches the current job's index. If the index is zero,
  1595    the register only occurs if the job is new. This paradigm allows check-and-set
  1596    style job updating.
  1597  
  1598  - `EvalPriority` `(int: 0)` - Override the priority of the evaluations produced
  1599    as a result of this job update. By default, this is set to the priority of
  1600    the job.
  1601  
  1602  - `JobModifyIndex` `(int: 0)` - Specifies the `JobModifyIndex` to enforce the
  1603    current job is at.
  1604  
  1605  - `PolicyOverride` `(bool: false)` - If set, any soft mandatory Sentinel policies
  1606    will be overridden. This allows a job to be registered when it would be denied
  1607    by policy.
  1608  
  1609  ### Sample Payload
  1610  
  1611  ```javascript
  1612  {
  1613    "Job": {
  1614      // ...
  1615    },
  1616    "EnforceIndex": true,
  1617    "JobModifyIndex": 4
  1618  }
  1619  ```
  1620  
  1621  ### Sample Request
  1622  
  1623  ```shell-session
  1624  $ curl \
  1625      --request POST \
  1626      --data @payload.json \
  1627      https://localhost:4646/v1/job/my-job
  1628  ```
  1629  
  1630  ### Sample Response
  1631  
  1632  ```json
  1633  {
  1634    "EvalID": "d092fdc0-e1fd-2536-67d8-43af8ca798ac",
  1635    "EvalCreateIndex": 35,
  1636    "JobModifyIndex": 34
  1637  }
  1638  ```
  1639  
  1640  ## Dispatch Job
  1641  
  1642  This endpoint dispatches a new instance of a parameterized job.
  1643  
  1644  | Method | Path                       | Produces           |
  1645  | ------ | -------------------------- | ------------------ |
  1646  | `POST` | `/v1/job/:job_id/dispatch` | `application/json` |
  1647  
  1648  The table below shows this endpoint's support for
  1649  [blocking queries](/api-docs#blocking-queries) and
  1650  [required ACLs](/api-docs#acls).
  1651  
  1652  | Blocking Queries | ACL Required             |
  1653  | ---------------- | ------------------------ |
  1654  | `NO`             | `namespace:dispatch-job` |
  1655  
  1656  ### Parameters
  1657  
  1658  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified
  1659    in the job file during submission). This is specified as part of the path.
  1660  
  1661  - `idempotency_token` `(string: "")` - Optional identifier used to prevent more
  1662    than one instance of the job from being dispatched. This is specified as a
  1663    URL query parameter.
  1664  
  1665  - `Payload` `(string: "")` - Specifies a base64 encoded string containing the
  1666    payload. This is limited to 16384 bytes (16KiB).
  1667  
  1668  - `Meta` `(meta<string|string>: nil)` - Specifies arbitrary metadata to pass to
  1669    the job.
  1670  
  1671  ### Sample Payload
  1672  
  1673  ```json
  1674  {
  1675    "Payload": "A28C3==",
  1676    "Meta": {
  1677      "key": "Value"
  1678    }
  1679  }
  1680  ```
  1681  
  1682  ### Sample Request
  1683  
  1684  ```shell-session
  1685  $ curl \
  1686      --request POST \
  1687      --data @payload.json \
  1688      https://localhost:4646/v1/job/my-job/dispatch
  1689  ```
  1690  
  1691  ### Sample Response
  1692  
  1693  ```json
  1694  {
  1695    "Index": 13,
  1696    "JobCreateIndex": 12,
  1697    "EvalCreateIndex": 13,
  1698    "EvalID": "e5f55fac-bc69-119d-528a-1fc7ade5e02c",
  1699    "DispatchedJobID": "example/dispatch-1485408778-81644024"
  1700  }
  1701  ```
  1702  
  1703  ## Revert to older Job Version
  1704  
  1705  This endpoint reverts the job to an older version.
  1706  
  1707  | Method | Path                     | Produces           |
  1708  | ------ | ------------------------ | ------------------ |
  1709  | `POST` | `/v1/job/:job_id/revert` | `application/json` |
  1710  
  1711  The table below shows this endpoint's support for
  1712  [blocking queries](/api-docs#blocking-queries) and
  1713  [required ACLs](/api-docs#acls).
  1714  
  1715  | Blocking Queries | ACL Required           |
  1716  | ---------------- | ---------------------- |
  1717  | `NO`             | `namespace:submit-job` |
  1718  
  1719  ### Parameters
  1720  
  1721  - `JobID` `(string: <required>)` - Specifies the ID of the job (as specified
  1722    in the job file during submission). This is specified as part of the path.
  1723  
  1724  - `JobVersion` `(integer: 0)` - Specifies the job version to revert to.
  1725  
  1726  - `EnforcePriorVersion` `(integer: nil)` - Optional value specifying the current
  1727    job's version. This is checked and acts as a check-and-set value before
  1728    reverting to the specified job.
  1729  
  1730  - `ConsulToken` `(string:"")` - Optional value specifying the [consul token](/docs/commands/job/revert)
  1731    used for Consul [service identity polity authentication checking](/docs/configuration/consul#allow_unauthenticated).
  1732  
  1733  - `VaultToken` `(string: "")` - Optional value specifying the [vault token](/docs/commands/job/revert)
  1734    used for Vault [policy authentication checking](/docs/configuration/vault#allow_unauthenticated).
  1735  
  1736  ### Sample Payload
  1737  
  1738  ```json
  1739  {
  1740    "JobID": "my-job",
  1741    "JobVersion": 2
  1742  }
  1743  ```
  1744  
  1745  ### Sample Request
  1746  
  1747  ```shell-session
  1748  $ curl \
  1749      --request POST \
  1750      --data @payload.json \
  1751      https://localhost:4646/v1/job/my-job/revert
  1752  ```
  1753  
  1754  ### Sample Response
  1755  
  1756  ```json
  1757  {
  1758    "EvalID": "d092fdc0-e1fd-2536-67d8-43af8ca798ac",
  1759    "EvalCreateIndex": 35,
  1760    "JobModifyIndex": 34
  1761  }
  1762  ```
  1763  
  1764  ## Set Job Stability
  1765  
  1766  This endpoint sets the job's stability.
  1767  
  1768  | Method | Path                     | Produces           |
  1769  | ------ | ------------------------ | ------------------ |
  1770  | `POST` | `/v1/job/:job_id/stable` | `application/json` |
  1771  
  1772  The table below shows this endpoint's support for
  1773  [blocking queries](/api-docs#blocking-queries) and
  1774  [required ACLs](/api-docs#acls).
  1775  
  1776  | Blocking Queries | ACL Required           |
  1777  | ---------------- | ---------------------- |
  1778  | `NO`             | `namespace:submit-job` |
  1779  
  1780  ### Parameters
  1781  
  1782  - `JobID` `(string: <required>)` - Specifies the ID of the job (as specified
  1783    in the job file during submission). This is specified as part of the path.
  1784  
  1785  - `JobVersion` `(integer: 0)` - Specifies the job version to set the stability on.
  1786  
  1787  - `Stable` `(bool: false)` - Specifies whether the job should be marked as
  1788    stable or not.
  1789  
  1790  ### Sample Payload
  1791  
  1792  ```json
  1793  {
  1794    "JobID": "my-job",
  1795    "JobVersion": 2,
  1796    "Stable": true
  1797  }
  1798  ```
  1799  
  1800  ### Sample Request
  1801  
  1802  ```shell-session
  1803  $ curl \
  1804      --request POST \
  1805      --data @payload.json \
  1806      https://localhost:4646/v1/job/my-job/stable
  1807  ```
  1808  
  1809  ### Sample Response
  1810  
  1811  ```json
  1812  {
  1813    "JobModifyIndex": 34
  1814  }
  1815  ```
  1816  
  1817  ## Create Job Evaluation
  1818  
  1819  This endpoint creates a new evaluation for the given job. This can be used to
  1820  force run the scheduling logic if necessary. Since Nomad 0.8.4, this endpoint
  1821  supports a JSON payload with additional options. Support for calling this end point
  1822  without a JSON payload will be removed in Nomad 0.9.
  1823  
  1824  | Method | Path                       | Produces           |
  1825  | ------ | -------------------------- | ------------------ |
  1826  | `POST` | `/v1/job/:job_id/evaluate` | `application/json` |
  1827  
  1828  The table below shows this endpoint's support for
  1829  [blocking queries](/api-docs#blocking-queries) and
  1830  [required ACLs](/api-docs#acls).
  1831  
  1832  | Blocking Queries | ACL Required         |
  1833  | ---------------- | -------------------- |
  1834  | `NO`             | `namespace:read-job` |
  1835  
  1836  ### Parameters
  1837  
  1838  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  1839    the job file during submission). This is specified as part of the path.
  1840  
  1841  - `JobID` `(string: <required>)` - Specify the ID of the job in the JSON payload
  1842  
  1843  - `EvalOptions` `(<optional>)` - Specify additional options to be used during the forced evaluation.
  1844    - `ForceReschedule` `(bool: false)` - If set, failed allocations of the job are rescheduled
  1845      immediately. This is useful for operators to force immediate placement even if the failed allocations are past
  1846      their reschedule limit, or are delayed by several hours because the allocation's reschedule policy has exponential delay.
  1847  
  1848  ### Sample Payload
  1849  
  1850  ```json
  1851  {
  1852    "JobID": "my-job",
  1853    "EvalOptions": {
  1854      "ForceReschedule": true
  1855    }
  1856  }
  1857  ```
  1858  
  1859  ### Sample Request
  1860  
  1861  ```shell-session
  1862  $ curl \
  1863      --request POST \
  1864      -d @sample.json \
  1865      https://localhost:4646/v1/job/my-job/evaluate
  1866  ```
  1867  
  1868  ### Sample Response
  1869  
  1870  ```json
  1871  {
  1872    "EvalID": "d092fdc0-e1fd-2536-67d8-43af8ca798ac",
  1873    "EvalCreateIndex": 35,
  1874    "JobModifyIndex": 34
  1875  }
  1876  ```
  1877  
  1878  ## Create Job Plan
  1879  
  1880  This endpoint invokes a dry-run of the scheduler for the job.
  1881  
  1882  | Method | Path                   | Produces           |
  1883  | ------ | ---------------------- | ------------------ |
  1884  | `POST` | `/v1/job/:job_id/plan` | `application/json` |
  1885  
  1886  The table below shows this endpoint's support for
  1887  [blocking queries](/api-docs#blocking-queries) and
  1888  [required ACLs](/api-docs#acls).
  1889  
  1890  | Blocking Queries | ACL Required                                                                      |
  1891  | ---------------- | --------------------------------------------------------------------------------- |
  1892  | `NO`             | `namespace:submit-job`<br />`namespace:sentinel-override` if `PolicyOverride` set |
  1893  
  1894  ### Parameters
  1895  
  1896  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  1897  - the job file during submission). This is specified as part of the path.
  1898  
  1899  - `Job` `(string: <required>)` - Specifies the JSON definition of the job.
  1900  
  1901  - `Diff` `(bool: false)` - Specifies whether the diff structure between the
  1902    submitted and server side version of the job should be included in the
  1903    response.
  1904  
  1905  - `PolicyOverride` `(bool: false)` - If set, any soft mandatory Sentinel policies
  1906    will be overridden. This allows a job to be registered when it would be denied
  1907    by policy.
  1908  
  1909  ### Sample Payload
  1910  
  1911  ```json
  1912  {
  1913    "Job": {
  1914      // ...
  1915    },
  1916    "Diff": true,
  1917    "PolicyOverride": false
  1918  }
  1919  ```
  1920  
  1921  ### Sample Request
  1922  
  1923  ```shell-session
  1924  $ curl \
  1925      --request POST \
  1926      --data @payload.json \
  1927      https://localhost:4646/v1/job/my-job/plan
  1928  ```
  1929  
  1930  ### Sample Response
  1931  
  1932  ```json
  1933  {
  1934    "Index": 0,
  1935    "NextPeriodicLaunch": "0001-01-01T00:00:00Z",
  1936    "Warnings": "",
  1937    "Diff": {
  1938      "Type": "Added",
  1939      "TaskGroups": [
  1940        {
  1941          "Updates": {
  1942            "create": 1
  1943          },
  1944          "Type": "Added",
  1945          "Tasks": [
  1946            {
  1947              "Type": "Added",
  1948              "Objects": ["..."],
  1949              "Name": "redis",
  1950              "Fields": [
  1951                {
  1952                  "Type": "Added",
  1953                  "Old": "",
  1954                  "New": "docker",
  1955                  "Name": "Driver",
  1956                  "Annotations": null
  1957                },
  1958                {
  1959                  "Type": "Added",
  1960                  "Old": "",
  1961                  "New": "5000000000",
  1962                  "Name": "KillTimeout",
  1963                  "Annotations": null
  1964                }
  1965              ],
  1966              "Annotations": ["forces create"]
  1967            }
  1968          ],
  1969          "Objects": ["..."],
  1970          "Name": "cache",
  1971          "Fields": ["..."]
  1972        }
  1973      ],
  1974      "Objects": [
  1975        {
  1976          "Type": "Added",
  1977          "Objects": null,
  1978          "Name": "Datacenters",
  1979          "Fields": ["..."]
  1980        },
  1981        {
  1982          "Type": "Added",
  1983          "Objects": null,
  1984          "Name": "Constraint",
  1985          "Fields": ["..."]
  1986        },
  1987        {
  1988          "Type": "Added",
  1989          "Objects": null,
  1990          "Name": "Update",
  1991          "Fields": ["..."]
  1992        }
  1993      ],
  1994      "ID": "example",
  1995      "Fields": ["..."]
  1996    },
  1997    "CreatedEvals": [
  1998      {
  1999        "ModifyIndex": 0,
  2000        "CreateIndex": 0,
  2001        "SnapshotIndex": 0,
  2002        "AnnotatePlan": false,
  2003        "EscapedComputedClass": false,
  2004        "NodeModifyIndex": 0,
  2005        "NodeID": "",
  2006        "JobModifyIndex": 0,
  2007        "JobID": "example",
  2008        "TriggeredBy": "job-register",
  2009        "Type": "batch",
  2010        "Priority": 50,
  2011        "ID": "312e6a6d-8d01-0daf-9105-14919a66dba3",
  2012        "Status": "blocked",
  2013        "StatusDescription": "created to place remaining allocations",
  2014        "Wait": 0,
  2015        "NextEval": "",
  2016        "PreviousEval": "80318ae4-7eda-e570-e59d-bc11df134817",
  2017        "BlockedEval": "",
  2018        "FailedTGAllocs": null,
  2019        "ClassEligibility": {
  2020          "v1:7968290453076422024": true
  2021        }
  2022      }
  2023    ],
  2024    "JobModifyIndex": 0,
  2025    "FailedTGAllocs": {
  2026      "cache": {
  2027        "CoalescedFailures": 3,
  2028        "AllocationTime": 46415,
  2029        "Scores": null,
  2030        "NodesEvaluated": 1,
  2031        "NodesFiltered": 0,
  2032        "NodesAvailable": {
  2033          "dc1": 1
  2034        },
  2035        "ClassFiltered": null,
  2036        "ConstraintFiltered": null,
  2037        "NodesExhausted": 1,
  2038        "ClassExhausted": null,
  2039        "DimensionExhausted": {
  2040          "cpu": 1
  2041        }
  2042      }
  2043    },
  2044    "Annotations": {
  2045      "DesiredTGUpdates": {
  2046        "cache": {
  2047          "DestructiveUpdate": 0,
  2048          "InPlaceUpdate": 0,
  2049          "Stop": 0,
  2050          "Migrate": 0,
  2051          "Place": 11,
  2052          "Ignore": 0
  2053        }
  2054      }
  2055    }
  2056  }
  2057  ```
  2058  
  2059  #### Field Reference
  2060  
  2061  - `Diff` - A diff structure between the submitted job and the server side
  2062    version. The top-level object is a Job Diff which contains Task Group Diffs,
  2063    which in turn contain Task Diffs. Each of these objects then has Object and
  2064    Field Diff structures embedded.
  2065  
  2066  - `NextPeriodicLaunch` - If the job being planned is periodic, this field will
  2067    include the next launch time for the job.
  2068  
  2069  - `CreatedEvals` - A set of evaluations that were created as a result of the
  2070    dry-run. These evaluations can signify a follow-up rolling update evaluation
  2071    or a blocked evaluation.
  2072  
  2073  - `JobModifyIndex` - The `JobModifyIndex` of the server side version of this job.
  2074  
  2075  - `FailedTGAllocs` - A set of metrics to understand any allocation failures that
  2076    occurred for the Task Group.
  2077  
  2078  - `Annotations` - Annotations include the `DesiredTGUpdates`, which tracks what
  2079  - the scheduler would do given enough resources for each Task Group.
  2080  
  2081  ## Force New Periodic Instance
  2082  
  2083  This endpoint forces a new instance of the periodic job. A new instance will be
  2084  created even if it violates the job's
  2085  [`prohibit_overlap`](/docs/job-specification/periodic#prohibit_overlap)
  2086  settings. As such, this should be only used to immediately run a periodic job.
  2087  
  2088  | Method | Path                             | Produces           |
  2089  | ------ | -------------------------------- | ------------------ |
  2090  | `POST` | `/v1/job/:job_id/periodic/force` | `application/json` |
  2091  
  2092  The table below shows this endpoint's support for
  2093  [blocking queries](/api-docs#blocking-queries) and
  2094  [required ACLs](/api-docs#acls).
  2095  
  2096  | Blocking Queries | ACL Required                                       |
  2097  | ---------------- | -------------------------------------------------- |
  2098  | `NO`             | `namespace:dispatch-job` or `namespace:submit-job` |
  2099  
  2100  ### Parameters
  2101  
  2102  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  2103    the job file during submission). This is specified as part of the path.
  2104  
  2105  ### Sample Request
  2106  
  2107  ```shell-session
  2108  $ curl \
  2109      --request POST \
  2110      https://localhost:4646/v1/job/my-job/periodic/force
  2111  ```
  2112  
  2113  ### Sample Response
  2114  
  2115  ```json
  2116  {
  2117    "EvalCreateIndex": 7,
  2118    "EvalID": "57983ddd-7fcf-3e3a-fd24-f699ccfb36f4"
  2119  }
  2120  ```
  2121  
  2122  ## Stop a Job
  2123  
  2124  This endpoint deregisters a job, and stops all allocations part of it.
  2125  
  2126  | Method   | Path              | Produces           |
  2127  | -------- | ----------------- | ------------------ |
  2128  | `DELETE` | `/v1/job/:job_id` | `application/json` |
  2129  
  2130  The table below shows this endpoint's support for
  2131  [blocking queries](/api-docs#blocking-queries) and
  2132  [required ACLs](/api-docs#acls).
  2133  
  2134  | Blocking Queries | ACL Required           |
  2135  | ---------------- | ---------------------- |
  2136  | `NO`             | `namespace:submit-job` |
  2137  
  2138  ### Parameters
  2139  
  2140  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  2141    the job file during submission). This is specified as part of the path.
  2142  
  2143  - `eval_priority` `(int: 0)` - Override the priority of the evaluations produced
  2144    as a result of this job deregistration. By default, this is set to the priority
  2145    of the job.
  2146  
  2147  - `global` `(bool: false)` - Stop a multi-region job in all its regions. By default,
  2148    job stop will stop only a single region at a time. Ignored for single-region jobs.
  2149  
  2150  - `purge` `(bool: false)` - Specifies that the job should be stopped and purged
  2151    immediately. This means the job will not be queryable after being stopped. If
  2152    not set, the job will be purged by the garbage collector.
  2153  
  2154  ### Sample Request
  2155  
  2156  ```shell-session
  2157  $ curl \
  2158      --request DELETE \
  2159      https://localhost:4646/v1/job/my-job?purge=true
  2160  ```
  2161  
  2162  ### Sample Response
  2163  
  2164  ```json
  2165  {
  2166    "EvalID": "d092fdc0-e1fd-2536-67d8-43af8ca798ac",
  2167    "EvalCreateIndex": 35,
  2168    "JobModifyIndex": 34
  2169  }
  2170  ```
  2171  
  2172  ## Read Job Scale Status
  2173  
  2174  This endpoint reads scale information about a job.
  2175  
  2176  | Method | Path                    | Produces           |
  2177  | ------ | ----------------------- | ------------------ |
  2178  | `GET`  | `/v1/job/:job_id/scale` | `application/json` |
  2179  
  2180  The table below shows this endpoint's support for
  2181  [blocking queries](/api-docs#blocking-queries) and
  2182  [required ACLs](/api-docs#acls).
  2183  
  2184  | Blocking Queries | ACL Required                                         |
  2185  | ---------------- | ---------------------------------------------------- |
  2186  | `YES`            | `namespace:read-job-scaling` or `namespace:read-job` |
  2187  
  2188  ### Parameters
  2189  
  2190  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  2191    the job file during submission). This is specified as part of the path.
  2192  
  2193  ### Sample Request
  2194  
  2195  ```shell-session
  2196  $ curl \
  2197      https://localhost:4646/v1/job/my-job/scale
  2198  ```
  2199  
  2200  ### Sample Response
  2201  
  2202  ```json
  2203  {
  2204    "JobCreateIndex": 10,
  2205    "JobID": "example",
  2206    "Namespace": "default",
  2207    "JobModifyIndex": 18,
  2208    "JobStopped": false,
  2209    "TaskGroups": {
  2210      "cache": {
  2211        "Desired": 1,
  2212        "Events": null,
  2213        "Healthy": 1,
  2214        "Placed": 1,
  2215        "Running": 0,
  2216        "Unhealthy": 0
  2217      }
  2218    }
  2219  }
  2220  ```
  2221  
  2222  ## Scale Task Group
  2223  
  2224  This endpoint performs a scaling action against a job.
  2225  Currently, this endpoint supports scaling the count for a task group.
  2226  This will return a 400 error if the job has an active deployment.
  2227  
  2228  | Method | Path                    | Produces           |
  2229  | ------ | ----------------------- | ------------------ |
  2230  | `POST` | `/v1/job/:job_id/scale` | `application/json` |
  2231  
  2232  The table below shows this endpoint's support for
  2233  [blocking queries](/api-docs#blocking-queries) and
  2234  [required ACLs](/api-docs#acls).
  2235  
  2236  | Blocking Queries | ACL Required                                                                                               |
  2237  | ---------------- | ---------------------------------------------------------------------------------------------------------- |
  2238  | `NO`             | `namespace:scale-job` or `namespace:submit-job`<br />`namespace:sentinel-override` if `PolicyOverride` set |
  2239  
  2240  ### Parameters
  2241  
  2242  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  2243    the job file during submission). This is specified as part of the path.
  2244  
  2245  - `Count` `(int: <optional>)` - Specifies the new task group count.
  2246  
  2247  - `Target` `(json: required)` - JSON map containing the target of the scaling operation.
  2248    Must contain a field `Group` with the name of the task group that is the target of this scaling action.
  2249  
  2250  - `Message` `(string: <optional>)` - Description of the scale action, persisted as part of the scaling event.
  2251    Indicates information or reason for scaling; one of `Message` or `Error` must be provided.
  2252  
  2253  - `Error` `(string: <optional>)` - Description of the scale action, persisted as part of the scaling event.
  2254    Indicates an error state preventing scaling; one of `Message` or `Error` must be provided.
  2255  
  2256  - `Meta` `(json: <optional>)` - JSON block that is persisted as part of the scaling event.
  2257  
  2258  - `PolicyOverride` `(bool: false)` - If set, any soft mandatory Sentinel policies
  2259    will be overridden. This allows a job to be scaled when it would be denied
  2260    by policy.
  2261  
  2262  ### Sample Payload
  2263  
  2264  ```javascript
  2265  {
  2266      "Count": 5,
  2267      "Meta": {
  2268          "metrics": [
  2269              "cpu",
  2270              "memory"
  2271          ]
  2272      },
  2273      "Message": "metric did not satisfy SLA",
  2274      "Target": {
  2275          "Group": "cache"
  2276      }
  2277  }
  2278  ```
  2279  
  2280  ### Sample Request
  2281  
  2282  ```shell-session
  2283  $ curl \
  2284      --request POST \
  2285      --data @payload.json \
  2286      https://localhost:4646/v1/job/example/scale
  2287  ```
  2288  
  2289  ### Sample Response
  2290  
  2291  This is the same payload as returned by job update.
  2292  `EvalCreateIndex` and `EvalID` will only be present if the scaling operation resulted in the creation of an evaluation.
  2293  
  2294  ```json
  2295  {
  2296    "EvalCreateIndex": 45,
  2297    "EvalID": "116f3ede-f6a5-f6e7-2d0e-1fda136390f0",
  2298    "Index": 45,
  2299    "JobModifyIndex": 44,
  2300    "KnownLeader": false,
  2301    "LastContact": 0,
  2302    "Warnings": ""
  2303  }
  2304  ```
  2305  
  2306  ## Job Services
  2307  
  2308  The endpoint is used to read all services registered within Nomad belonging to the passed job ID.
  2309  
  2310  | Method | Path                    | Produces           |
  2311  | ------ | ----------------------- | ------------------ |
  2312  | `GET`  | `/job/:job_id/services` | `application/json` |
  2313  
  2314  The table below shows this endpoint's support for
  2315  [blocking queries](/api-docs#blocking-queries), [consistency modes](/api-docs#consistency-modes) and
  2316  [required ACLs](/api-docs#acls).
  2317  
  2318  | Blocking Queries | Consistency Modes | ACL Required         |
  2319  | ---------------- | ----------------- | -------------------- |
  2320  | `YES`            | `all`             | `namespace:read-job` |
  2321  
  2322  ### Parameters
  2323  
  2324  - `:job_id` `(string: <required>)` - Specifies the ID of the job (as specified in
  2325  the job file during submission). This is specified as part of the path.
  2326  
  2327  - `namespace` `(string: "default")` - Specifies the target namespace.
  2328  
  2329  ### Sample Request
  2330  
  2331  ```shell-session
  2332  $ curl \
  2333      https://localhost:4646/v1/job/example/services
  2334  ```
  2335  
  2336  ### Sample Response
  2337  
  2338  ```json
  2339  [
  2340    {
  2341      "Address": "127.0.0.1",
  2342      "AllocID": "177160af-26f6-619f-9c9f-5e46d1104395",
  2343      "CreateIndex": 14,
  2344      "Datacenter": "dc1",
  2345      "ID": "_nomad-task-177160af-26f6-619f-9c9f-5e46d1104395-redis-example-cache-redis-db",
  2346      "JobID": "example",
  2347      "ModifyIndex": 24,
  2348      "Namespace": "default",
  2349      "NodeID": "7406e90b-de16-d118-80fe-60d0f2730cb3",
  2350      "Port": 29702,
  2351      "ServiceName": "example-cache-redis",
  2352      "Tags": [
  2353        "db",
  2354        "cache"
  2355      ]
  2356    }
  2357  ]
  2358  ```