Open this page in the API Guide

PUT /Job/EnableJob/{id}/

Enables or disables a job.
 

Request

Method Request URI
put /API/Job/EnableJob/{id}/?sessionId=value

URI Parameters

URI Parameter Description
sessionId The current session ID. Specifying via an Authorization request header instead is recommended.

Path Parameters

Path Parameter Description
id The ID of the job to enable or disable.

Request Headers

Authorization: Bearer <Current session ID>

Request Body

Name: enabled
Type: System.Boolean

Response

Response Body

A System.Boolean indicating success (or failure if the job is running) or an error message.

Response Codes

Response Code Description
200 The operation completed successfully.
400 The request contained one or more invalid parameters.

Examples

This example will login and disable the job with ID = be1614b2-5c83-4a88-86e8-a2a56b915c97.

C# Java JavaScript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System.Net;
using System.Net.Http;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Web.Script.Serialization;
 
   ...
 
using (HttpClient httpClient = new HttpClient())
{
    // Get Session Id
    string logonUri = "http://localhost:8004/Api/LogOn/";
    var logonOptions = new
    {
        accountName = "admin",
        password = "1234",
        cultureName = string.Empty,
        deleteOtherSessions = true,
        isWindowsLogOn = false
    };
 
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    var requestBodyAsString = serializer.Serialize(logonOptions);
    StringContent content =
        new StringContent(
            requestBodyAsString,
            Encoding.UTF8,
            "application/json"
        );
 
    string jsonString = string.Empty;
 
    using (var response = httpClient.PostAsync(logonUri, content).Result)
    {
        jsonString =
            response.Content.ReadAsStringAsync().Result;
    }
 
    var obj = (Dictionary<string,object>) serializer.DeserializeObject(jsonString);
    string sessionId = obj["sessionId"].ToString();
 
    // Add an Authorization header
    httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", sessionId);
 
    // Define the request body
    HttpContent requestBody = null;
    requestBody =
        new StringContent(@"
        false",Encoding.UTF8,"application/json");
    using (var response = httpClient.PutAsync(url, requestBody).Result)
    {
        if(response.StatusCode == HttpStatusCode.OK)
        {
            Console.WriteLine("Success");
        }
    }
}