Registering a Job Kill Order

Problem

You want to kill a process associated with a content item.

Solution

Use the API to delete a job using its job key. You’ll need the GUID for the content item, and the job key associated with the job you wish to kill.

from posit import connect

CONTENT_ITEM_GUID = '154bd2af-e8fa-4aa4-aab8-dcef701f4af9'
JOB_KEY = 'CwCoI9tizMRRcvLw'

client = connect.Client()
client.delete(f"v1/content/{CONTENT_ITEM_GUID}/jobs/{JOB_KEY}")
library(connectapi)
library(httr)

CONTENT_ITEM_GUID <- "154bd2af-e8fa-4aa4-aab8-dcef701f4af9"
JOB_KEY <- "CwCoI9tizMRRcvLw"

client <- connect()
response <- client$DELETE(
    glue::glue("v1/content/{CONTENT_ITEM_GUID}/jobs/{JOB_KEY}"),
)
> print(response)
Response [https://connect.company.co/__api__/v1/content/fdc3f938-3ace-4a22-8af2-1a8f17828b6a/jobs/CwCoI9tizMRRcvLw]
  Date: 2024-06-21 17:48
  Status: 200
  Content-Type: application/json; charset=utf-8
  Size: 199 B