任务

如何管理用户数据删除任务。

任务

检索所有任务,包括已完成或已取消的任务。

GET

/api/v1/:projectKey/jobs

Authorization: {YOUR_ORGANIZATION_API_KEY}:可在 ‘Preferences’ > ‘Account’ > ‘Organization API Key’ 中找到该密钥。

200:响应以 JSON 形式发送在正文中

curl -X GET \
  https://openreplay.example.com/api/v1/3sWXSsqHgSKnE87YkNJK/jobs \
  -H 'content-type: application/json' \
  -H 'Authorization: {YOUR_ORGANIZATION_API_KEY}'
{
  "data": [
    {
      "jobId": 3451,
      "description": "Delete user sessions of userId = shekar@example.com",
      "status": "scheduled",
      "projectId": 1,
      "action": "delete_user_data",
      "referenceId": "mehdi@openreplay.com",
      "createdAt": 1623912955277,
      "updatedAt": 1623912955277,
      "startAt": 1623954600000,
      "errors": null
    },
    {
      "jobId": 3452,
      "description": "Delete user sessions of userId = shekar@example.com",
      "status": "cancelled",
      "projectId": 1,
      "action": "delete_user_data",
      "referenceId": "mehdi@openreplay.com",
      "createdAt": 1623912962910,
      "updatedAt": 1623913015276,
      "startAt": 1623954600000,
      "errors": null
    }
  ]
}

返回任务的 status 以及其他详情,例如 createdAtreferenceIderrors

GET

/api/v1/:projectKey/jobs/:jobId

名称类型描述
jobIdstring用户删除调用返回的 ID(必填)

Authorization: {YOUR_ORGANIZATION_API_KEY}:可在 ‘Preferences’ > ‘Account’ > ‘Organization API Key’ 中找到该密钥。

200:响应以 JSON 形式发送在正文中

curl -X GET \
  https://openreplay.example.com/api/v1/3sWXSsqHgSKnE87YkNJK/jobs/3451\
  -H 'content-type: application/json' \
  -H 'Authorization: {YOUR_ORGANIZATION_API_KEY}'
{
  "data": {
    "jobId": 3451,
    "description": "Delete user sessions of userId = shekar@example.com",
    "status": "scheduled",
    "projectId": 1,
    "action": "delete_user_data",
    "referenceId": "mehdi@openreplay.com",
    "createdAt": 1623912955277,
    "updatedAt": 1623912955277,
    "startAt": 1623954600000,
    "errors": null
  }
}

如果任务尚未开始或仍在进行中,可以取消该任务。

DELETE

/api/v1/:projectKey/jobs/:jobId

名称类型描述
jobIdstring用户删除调用返回的 ID(必填)

Authorization: {YOUR_ORGANIZATION_API_KEY}:可在 ‘Preferences’ > ‘Account’ > ‘Organization API Key’ 中找到该密钥。

200:响应以 JSON 形式发送在正文中 501:如果任务无法取消则返回此状态码

curl -X DELETE \
  https://openreplay.example.com/api/v1/3sWXSsqHgSKnE87YkNJK/jobs/3452 \
  -H 'content-type: application/json' \
  -H 'Authorization: {YOUR_ORGANIZATION_API_KEY}'
{
  "data": {
    "jobId": 3452,
    "description": "Delete user sessions of userId = shekar@example.com",
    "status": "cancelled",
    "projectId": 1,
    "action": "delete_user_data",
    "referenceId": "mehdi@openreplay.com",
    "createdAt": 1623912962910,
    "updatedAt": 1623913015276,
    "startAt": 1623954600000,
    "errors": null
  }
}