Autonomous Identity 2022.11.11

Jobs

You can define, run, and get the status of each job using REST API endpoints. When using REST calls, the available job types are the following:

  • ingest

  • train

  • mine

  • predict-as-is

  • recommend

  • load

  • create-assignment-index

  • create-assignment-index-report

  • anomaly

  • insight

  • audit

The following are Autonomous Identity jobs endpoints:

POST /api/job_definition

POST /api/job_definition

Set up a job definition.

Endpoint

/api/job_definition

Authorization

Bearer <Token JWT-value> or
<API Key-value>

Body

{
  "branch": "actual",
  "contextId": "40c20f01-a9d8-4284-b290-c8b6ccdb8b77",
  "entityData": [
    {
      "job_name": "ShowCaseCSVAnomaly",
      "job_type": "anomaly",
      "job_parameters": {
        "driverMemory": "2g",
        "driverCores": 3,
        "executorMemory": "3G",
        "executorCores": 6
      }
    }
  ],
  "indexingRequired": true,
  "tags": {},
  "indexInSync": true
}
contextId is a unique identifier string. It can be anything you define.

Example Request

curl 'https://autoid-ui.forgerock.com/jas/entity/persist/autoid/api/job_definition' \
  -H 'authority: autoid-ui.forgerock.com' \
  -H 'sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"' \
  -H 'accept: application/json, text/plain, /' \
  -H 'x-tenant-id: 8700f5cb-eaca-461e-8c2e-245a25f2399d' \
  -H 'authorization: 1b7789f0-6c2f-4afa-a84b-a65a28f5c1a1' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36' \
  -H 'content-type: application/json' \
  -H 'origin: https://autoid-ui.forgerock.com' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-dest: empty' \
  -H 'referer: https://autoid-ui.forgerock.com/jobs' \
  -H 'accept-language: en-US,en;q=0.9' \
  --data-raw '{
                "branch": "actual",
                "contextId": "40c20f01-a9d8-4284-b290-c8b6ccdb8b77",
                "entityData": [
                  {
                    "job_name": "ShowCaseCSVAnomaly",
                    "job_type": "anomaly",
                    "job_parameters": {
                      "driverMemory": "2g",
                      "driverCores": 3,
                      "executorMemory": "3G",
                      "executorCores": 6
                    }
                  }
                ],
                "indexingRequired": true,
                "tags": {},
                "indexInSync": true
              }' \
  --compressed \
  --insecure
  }
}’

The Job definition for data ingestion requires a datasourceId, which you can query. Refer to [get-datasource-id].

Example Request (ingest)

curl 'https://autoid-ui.forgerock.com/jas/entity/persist/autoid/api/job_definition' \
  -H 'authority: autoid-ui.forgerock.com' \
  -H 'sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"' \
  -H 'accept: application/json, text/plain, /' \
  -H 'x-tenant-id: 8700f5cb-eaca-461e-8c2e-245a25f2399d' \
  -H 'authorization: 1b7789f0-6c2f-4afa-a84b-a65a28f5c1a1' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36' \
  -H 'content-type: application/json' \
  -H 'origin: https://autoid-ui.forgerock.com' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-dest: empty' \
  -H 'referer: https://autoid-ui.forgerock.com/jobs' \
  -H 'accept-language: en-US,en;q=0.9' \
  --data-raw '{
                "branch": "actual",
                "contextId": "ba9cefff-1e06-4cc3-b7d6-d15e2126351c",
                "entityData": [
                  {
                    "job_name": "ShowCaseCSVIngest",
                    "job_type": "ingest",
                    "job_parameters": {
                      "driverMemory": "2g",
                      "driverCores": 3,
                      "executorMemory": "3G",
                      "executorCores": 6,
                      "datasourceId": "2d7a6a76-469c-4035-b312-fb1daf104e98"
                    }
                  }
                ],
                "indexingRequired": true,
                "tags": {},
                "indexInSync": true
              }' \
  --compressed \
  --insecure

POST /jas/job/run

POST /jas/job/run

Run the job definition.

Endpoint

/jas/job/run

Authorization

Bearer <Token JWT-value> or
<API Key-value>

Body

{
    "jobType":"ingest",
    "jobDefinitionName":"ShowCaseCSVIngest"
}

Example Request

curl 'https://autoid-ui.forgerock.com/jas/job/run' \
  -H 'authority: autoid-ui.forgerock.com' \
  -H 'sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"' \
  -H 'accept: application/json, text/plain, /' \
  -H 'x-tenant-id: 8700f5cb-eaca-461e-8c2e-245a25f2399d' \
  -H 'authorization: 1b7789f0-6c2f-4afa-a84b-a65a28f5c1a1' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36' \
  -H 'content-type: application/json' \
  -H 'origin: https://autoid-ui.forgerock.com' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-dest: empty' \
  -H 'referer: https://autoid-ui.forgerock.com/jobs' \
  -H 'accept-language: en-US,en;q=0.9' \
  --data-raw '{
    "jobType":"ingest",
    "jobDefinitionName":"ShowCaseCSVIngest"
  }' \
  --compressed \
  --insecure

GET /jas/job/status

GET /jas/job/status

Obtain the job’s status.

Endpoint

/jas/job/status

Authorization

Bearer <Token JWT-value> or
<API Key-value>

Body

{
    "jobType":"anomaly",
    "jobDefinitionName":"ShowCaseCSVAnomaly"
}

Example Request

curl 'https://autoid-ui.forgerock.com/jas/job/status' \
  -H 'authority: autoid-ui.forgerock.com' \
  -H 'sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"' \
  -H 'accept: application/json, text/plain, /' \
  -H 'x-tenant-id: 8700f5cb-eaca-461e-8c2e-245a25f2399d' \
  -H 'authorization: 1b7789f0-6c2f-4afa-a84b-a65a28f5c1a1' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36' \
  -H 'content-type: application/json' \
  -H 'origin: https://autoid-ui.forgerock.com' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-dest: empty' \
  -H 'referer: https://autoid-ui.forgerock.com/jobs' \
  -H 'accept-language: en-US,en;q=0.9' \
  --data-raw '{
    "jobType":"anomaly",
    "jobDefinitionName":"ShowCaseCSVAnomaly"
  }' \
  --compressed \
  --insecure
GET /jas/job/search

Search for a job definition.

Endpoint

/jas/job/search

Authorization

Bearer <Token JWT-value> or
<API Key-value>

Body

{
  "query": {
    "sort": [
      {
        "job_name.keyword": {
          "order": "asc"
        }
      },
      {
        "metadata.primaryKey.keyword": {
          "order": "desc"
        }
      }
    ],
    "size": 10,
    "track_total_hits": true,
    "query": {
      "match_all": {}
    }
  }
}

Example Request

curl 'https://autoid-ui.forgerock.com/jas/entity/search/autoid/api/job_definition' \
  -H 'authority: autoid-ui.forgerock.com' \
  -H 'sec-ch-ua: "Chromium";v="92", " Not A;Brand";v="99", "Google Chrome";v="92"' \
  -H 'accept: application/json, text/plain, /' \
  -H 'x-tenant-id: 8700f5cb-eaca-461e-8c2e-245a25f2399d' \
  -H 'authorization: 1b7789f0-6c2f-4afa-a84b-a65a28f5c1a1' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36' \
  -H 'content-type: application/json' \
  -H 'origin: https://autoid-ui.forgerock.com' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-mode: cors' \
  -H 'sec-fetch-dest: empty' \
  -H 'referer: https://autoid-ui.forgerock.com/jobs' \
  -H 'accept-language: en-US,en;q=0.9' \
  --data-raw '{
                "query": {
                  "sort": [
                    {
                      "job_name.keyword": {
                        "order": "asc"
                      }
                    },
                    {
                      "metadata.primaryKey.keyword": {
                        "order": "desc"
                      }
                    }
                  ],
                  "size": 10,
                  "track_total_hits": true,
                  "query": {
                    "match_all": {}
                  }
                }
              }' \
  --compressed \
  --insecure