Package org.apache.nutch.service.resources

## Class JobResource

- java.lang.Object
- - org.apache.nutch.service.resources.AbstractResource
  - - org.apache.nutch.service.resources.JobResource

-     @Path("/job")
      public class JobResource
      extends AbstractResource

- - ### Field Summary

    - ### Fields inherited from class org.apache.nutch.service.resources.AbstractResource

      `configManager, jobManager, server`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `JobResource()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `abort​(String id, String crawlId)` |
    `JobInfo` | `create​(JobConfig config)` | Create a new job
    `JobInfo` | `getInfo​(String id, String crawlId)` | Get job info
    `Collection<JobInfo>` | `getJobs​(String crawlId)` | Get job history for a given job regardless of the jobs state
    `boolean` | `stop​(String id, String crawlId)` | Stop Job

    - ### Methods inherited from class org.apache.nutch.service.resources.AbstractResource

      `throwBadRequestException`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JobResource

          public JobResource()

  - ### Method Detail

    - #### getJobs

          @GET
          @Path("/")
          public Collection<JobInfo> getJobs​(@QueryParam("crawlId")
                                             String crawlId)

      Get job history for a given job regardless of the jobs state
      Parameters:
        `crawlId` - a crawlId
      Returns:
        A nested JSON object of all the jobs created for that crawlId

    - #### getInfo

          @GET
          @Path("/{id}")
          public JobInfo getInfo​(@PathParam("id")
                                 String id,
                                 @QueryParam("crawlId")
                                 String crawlId)

      Get job info
      Parameters:
        `id` - Job ID
        `crawlId` - Crawl ID
      Returns:
        A JSON object of job parameters

    - #### stop

          @GET
          @Path("/{id}/stop")
          public boolean stop​(@PathParam("id")
                              String id,
                              @QueryParam("crawlId")
                              String crawlId)

      Stop Job
      Parameters:
        `id` - Job ID
        `crawlId` - Crawl ID
      Returns:
        true if stopped, false otherwise

    - #### abort

          @GET
          @Path("/{id}/abort")
          public boolean abort​(@PathParam("id")
                               String id,
                               @QueryParam("crawlId")
                               String crawlId)

    - #### create

          @POST
          @Path("/create")
          @Consumes("application/json")
          public JobInfo create​(JobConfig config)

      Create a new job
      Parameters:
        `config` - The parameters of the job to create
      Returns:
        A JSON object of the job created with its details