nexthink_api 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. docs/Campaigns.md +36 -0
  2. docs/DataManagement.md +108 -0
  3. docs/Enrichment.md +67 -0
  4. docs/Nql.md +34 -0
  5. docs/RemoteActions.md +52 -0
  6. docs/Spark.md +62 -0
  7. docs/Workflows.md +81 -0
  8. docs/examples.md +161 -0
  9. docs/extra.css +4 -0
  10. docs/index.md +56 -0
  11. docs/migration-0.1.0.md +225 -0
  12. docs/nxt_api_request.md +26 -0
  13. docs/nxt_endpoint.md +2 -0
  14. docs/nxt_invalid_token_request.md +2 -0
  15. docs/nxt_region_name.md +2 -0
  16. docs/nxt_response.md +2 -0
  17. docs/nxt_settings.md +2 -0
  18. docs/nxt_token_request.md +2 -0
  19. docs/nxt_token_response.md +2 -0
  20. docs/object-models/Campaigns.md +5 -0
  21. docs/object-models/DataManagement.md +6 -0
  22. docs/object-models/Enrichment.md +5 -0
  23. docs/object-models/Nql.md +6 -0
  24. docs/object-models/RemoteActions.md +6 -0
  25. docs/object-models/Spark.md +5 -0
  26. docs/object-models/Workflows.md +6 -0
  27. nexthink_api/Campaigns/__init__.py +13 -0
  28. nexthink_api/Campaigns/nxt_campaign_trigger_error_response.py +12 -0
  29. nexthink_api/Campaigns/nxt_campaign_trigger_request.py +15 -0
  30. nexthink_api/Campaigns/nxt_campaign_trigger_response_details.py +14 -0
  31. nexthink_api/Campaigns/nxt_campaign_trigger_success_response.py +13 -0
  32. nexthink_api/Clients/__init__.py +33 -0
  33. nexthink_api/Clients/nexthink_client.py +9 -0
  34. nexthink_api/Clients/nxt_api_client.py +531 -0
  35. nexthink_api/Clients/nxt_campaigns_client.py +29 -0
  36. nexthink_api/Clients/nxt_client_facade.py +37 -0
  37. nexthink_api/Clients/nxt_data_management_client.py +71 -0
  38. nexthink_api/Clients/nxt_enrichment_client.py +32 -0
  39. nexthink_api/Clients/nxt_http_transport.py +185 -0
  40. nexthink_api/Clients/nxt_nql_client.py +130 -0
  41. nexthink_api/Clients/nxt_remote_actions_client.py +51 -0
  42. nexthink_api/Clients/nxt_response.py +181 -0
  43. nexthink_api/Clients/nxt_response_builders.py +362 -0
  44. nexthink_api/Clients/nxt_spark_client.py +46 -0
  45. nexthink_api/Clients/nxt_tls.py +45 -0
  46. nexthink_api/Clients/nxt_token_provider.py +77 -0
  47. nexthink_api/Clients/nxt_workflows_client.py +109 -0
  48. nexthink_api/DataManagement/__init__.py +23 -0
  49. nexthink_api/DataManagement/nxt_data_management_error_code.py +16 -0
  50. nexthink_api/DataManagement/nxt_data_management_error_response.py +26 -0
  51. nexthink_api/DataManagement/nxt_data_management_status.py +22 -0
  52. nexthink_api/DataManagement/nxt_device_deletion_request.py +20 -0
  53. nexthink_api/DataManagement/nxt_device_deletion_response.py +31 -0
  54. nexthink_api/DataManagement/nxt_device_entry.py +21 -0
  55. nexthink_api/DataManagement/nxt_device_status.py +26 -0
  56. nexthink_api/DataManagement/nxt_uid_validation_mode.py +13 -0
  57. nexthink_api/Enrichment/__init__.py +32 -0
  58. nexthink_api/Enrichment/nxt_bad_request_response.py +25 -0
  59. nexthink_api/Enrichment/nxt_enrichment.py +28 -0
  60. nexthink_api/Enrichment/nxt_enrichment_request.py +38 -0
  61. nexthink_api/Enrichment/nxt_error.py +21 -0
  62. nexthink_api/Enrichment/nxt_field.py +93 -0
  63. nexthink_api/Enrichment/nxt_field_name.py +22 -0
  64. nexthink_api/Enrichment/nxt_forbidden_response.py +18 -0
  65. nexthink_api/Enrichment/nxt_identification.py +86 -0
  66. nexthink_api/Enrichment/nxt_identification_name.py +17 -0
  67. nexthink_api/Enrichment/nxt_individual_object_error.py +32 -0
  68. nexthink_api/Enrichment/nxt_partial_success_response.py +25 -0
  69. nexthink_api/Enrichment/nxt_success_response.py +19 -0
  70. nexthink_api/Exceptions/__init__.py +21 -0
  71. nexthink_api/Exceptions/nxt_api_exception.py +7 -0
  72. nexthink_api/Exceptions/nxt_exception.py +7 -0
  73. nexthink_api/Exceptions/nxt_export_exception.py +7 -0
  74. nexthink_api/Exceptions/nxt_legacy_api_warning.py +5 -0
  75. nexthink_api/Exceptions/nxt_param_exception.py +7 -0
  76. nexthink_api/Exceptions/nxt_status_exception.py +7 -0
  77. nexthink_api/Exceptions/nxt_timeout_exception.py +7 -0
  78. nexthink_api/Exceptions/nxt_token_exception.py +7 -0
  79. nexthink_api/Models/__init__.py +17 -0
  80. nexthink_api/Models/nxt_endpoint.py +46 -0
  81. nexthink_api/Models/nxt_invalid_token_request.py +21 -0
  82. nexthink_api/Models/nxt_region_name.py +12 -0
  83. nexthink_api/Models/nxt_settings.py +97 -0
  84. nexthink_api/Models/nxt_token_request.py +34 -0
  85. nexthink_api/Models/nxt_token_response.py +26 -0
  86. nexthink_api/Nql/__init__.py +21 -0
  87. nexthink_api/Nql/nxt_date_time.py +78 -0
  88. nexthink_api/Nql/nxt_error_response.py +25 -0
  89. nexthink_api/Nql/nxt_nql_api_execute_request.py +39 -0
  90. nexthink_api/Nql/nxt_nql_api_execute_response.py +32 -0
  91. nexthink_api/Nql/nxt_nql_api_execute_v2_response.py +57 -0
  92. nexthink_api/Nql/nxt_nql_api_export_response.py +30 -0
  93. nexthink_api/Nql/nxt_nql_api_status_response.py +45 -0
  94. nexthink_api/Nql/nxt_nql_status.py +14 -0
  95. nexthink_api/RemoteActions/__init__.py +29 -0
  96. nexthink_api/RemoteActions/nxt_remote_action_error_response.py +12 -0
  97. nexthink_api/RemoteActions/nxt_remote_action_execution_request.py +18 -0
  98. nexthink_api/RemoteActions/nxt_remote_action_execution_response.py +13 -0
  99. nexthink_api/RemoteActions/nxt_remote_action_models.py +89 -0
  100. nexthink_api/RemoteActions/nxt_remote_action_trigger_info_request.py +14 -0
  101. nexthink_api/Spark/__init__.py +19 -0
  102. nexthink_api/Spark/nxt_spark_error_response.py +11 -0
  103. nexthink_api/Spark/nxt_spark_handoff_conversation_message_request.py +14 -0
  104. nexthink_api/Spark/nxt_spark_handoff_success_response.py +11 -0
  105. nexthink_api/Spark/nxt_spark_message_dto.py +13 -0
  106. nexthink_api/Spark/nxt_spark_parts.py +30 -0
  107. nexthink_api/Utils/__init__.py +3 -0
  108. nexthink_api/Utils/nxt_spec_registry.py +305 -0
  109. nexthink_api/Workflows/__init__.py +35 -0
  110. nexthink_api/Workflows/nxt_workflow_error_response.py +12 -0
  111. nexthink_api/Workflows/nxt_workflow_execution_request.py +27 -0
  112. nexthink_api/Workflows/nxt_workflow_execution_response.py +13 -0
  113. nexthink_api/Workflows/nxt_workflow_external_ids_execution_request.py +58 -0
  114. nexthink_api/Workflows/nxt_workflow_models.py +58 -0
  115. nexthink_api/Workflows/nxt_workflow_thinklet_trigger_request.py +11 -0
  116. nexthink_api/Workflows/nxt_workflow_thinklet_trigger_response.py +12 -0
  117. nexthink_api/Workflows/nxt_workflow_trigger_info.py +16 -0
  118. nexthink_api/__init__.py +190 -0
  119. nexthink_api/_version.py +24 -0
  120. nexthink_api-0.1.1.dist-info/METADATA +179 -0
  121. nexthink_api-0.1.1.dist-info/RECORD +124 -0
  122. nexthink_api-0.1.1.dist-info/WHEEL +5 -0
  123. nexthink_api-0.1.1.dist-info/licenses/LICENSE +619 -0
  124. nexthink_api-0.1.1.dist-info/top_level.txt +2 -0
docs/Campaigns.md ADDED
@@ -0,0 +1,36 @@
1
+ # Campaigns
2
+
3
+ Campaigns exposes Nexthink campaign triggering through
4
+ `NexthinkClient.campaigns`.
5
+
6
+ Triggering a campaign sends it to real users. Keep an explicit operator
7
+ confirmation in scripts that run outside tests.
8
+
9
+ ## Trigger a campaign
10
+
11
+ ```python
12
+ from nexthink_api import NexthinkClient, NxtRegionName
13
+ from nexthink_api.Campaigns import NxtCampaignTriggerRequest
14
+
15
+ client = NexthinkClient(
16
+ instance="example",
17
+ region=NxtRegionName.eu,
18
+ client_id="client-id",
19
+ client_secret="client-secret",
20
+ )
21
+
22
+ request = NxtCampaignTriggerRequest(
23
+ campaignNqlId="#campaign_nql_id",
24
+ userSid=["S-1-5-21-..."],
25
+ expiresInMinutes=60,
26
+ parameters={"language": "fr"},
27
+ )
28
+
29
+ result = client.campaigns.trigger(request)
30
+ ```
31
+
32
+ `userSid` accepts between 1 and 10000 user SIDs. `expiresInMinutes` must be
33
+ between 1 and 525600. `parameters` accepts up to 30 entries when provided.
34
+
35
+ See [Campaigns object models](object-models/Campaigns.md) for the request and
36
+ response classes used by this domain.
docs/DataManagement.md ADDED
@@ -0,0 +1,108 @@
1
+ # Data Management
2
+
3
+ The Data Management API schedules device deletions from the Nexthink inventory.
4
+
5
+ Use `NexthinkClient.data_management.delete_devices()` with one to 100 devices. The API is
6
+ asynchronous: a `202 ACCEPTED` response means the deletion batch was queued, not
7
+ that devices have already been removed. Inspect each returned device status to
8
+ confirm whether a device was scheduled, rejected as invalid, or failed.
9
+
10
+ ## Batch Limit And Asynchronous Behavior
11
+
12
+ Each request must contain at least one device and at most 100 devices. Split
13
+ larger deletion sets into multiple batches before calling `delete_devices()`.
14
+
15
+ Deletion scheduling is asynchronous. A successful `202 ACCEPTED` response only
16
+ confirms that the API accepted the batch for processing. It does not confirm
17
+ that inventory deletion has already completed.
18
+
19
+ ## Schedule Device Deletions
20
+
21
+ ```python
22
+ from nexthink_api import (
23
+ NexthinkClient,
24
+ NxtDeviceEntry,
25
+ NxtRegionName,
26
+ NxtUidValidationMode,
27
+ )
28
+
29
+ client = NexthinkClient(
30
+ instance="tenant-name",
31
+ region=NxtRegionName.eu,
32
+ client_id="client-id",
33
+ client_secret="client-secret",
34
+ )
35
+
36
+ response = client.data_management.delete_devices(
37
+ # Maximum 100 devices per request. Split larger inputs into batches.
38
+ devices=[
39
+ NxtDeviceEntry(
40
+ uid="00000000-0000-0000-0000-000000000000",
41
+ name="DEVICE-1",
42
+ ),
43
+ ],
44
+ request_id="11111111-1111-1111-1111-111111111111",
45
+ uid_validation=NxtUidValidationMode.WARN,
46
+ )
47
+
48
+ for device in response.devices:
49
+ # The API is asynchronous: SCHEDULED means queued, not already deleted.
50
+ print(device.uid, device.name, device.status)
51
+ ```
52
+
53
+ ## UID Validation
54
+
55
+ `delete_devices()` validates UID format before the request. The default mode is
56
+ `NxtUidValidationMode.WARN`.
57
+
58
+ | Mode | Behavior |
59
+ | --- | --- |
60
+ | `STRICT` | Raises `ValueError` before the API call if any UID is malformed. |
61
+ | `WARN` | Logs malformed UIDs and still sends the request. |
62
+ | `PERMISSIVE` | Sends the request without local UID warnings. |
63
+
64
+ `WARN` and `PERMISSIVE` allow the API to return per-device `INVALID` statuses,
65
+ which is useful when testing or preserving server-side behavior.
66
+
67
+ ## Correlation Header
68
+
69
+ Pass `request_id` to send an optional `x-request-id` header for support
70
+ correlation:
71
+
72
+ ```python
73
+ client.data_management.delete_devices(
74
+ devices=[NxtDeviceEntry(uid="00000000-0000-0000-0000-000000000000", name="DEVICE-1")],
75
+ request_id="11111111-1111-1111-1111-111111111111",
76
+ )
77
+ ```
78
+
79
+ The request header is applied only to that call and does not mutate the client's
80
+ stored headers.
81
+
82
+ When the API returns an `x-request-id` response header, Data Management success
83
+ and error responses expose it as `response.request_id`.
84
+
85
+ ## Responses
86
+
87
+ Successful scheduling returns `NxtDeviceDeletionResponse`:
88
+
89
+ ```python
90
+ if response.status == "ACCEPTED":
91
+ for device in response.devices:
92
+ if device.status == "SCHEDULED":
93
+ print(f"{device.name} queued for deletion")
94
+ ```
95
+
96
+ Documented device statuses are:
97
+
98
+ | Status | Meaning |
99
+ | --- | --- |
100
+ | `SCHEDULED` | Device deletion was queued. |
101
+ | `INVALID` | Device entry was rejected, for example because the UID is malformed. |
102
+ | `FAILED` | Device could not be scheduled for deletion. |
103
+
104
+ Documented error responses are represented by `NxtDataManagementErrorResponse`.
105
+ `401` responses are represented by `NxtInvalidTokenRequest`.
106
+
107
+ See [Data Management object models](object-models/DataManagement.md) for the
108
+ request and response classes used by this domain.
docs/Enrichment.md ADDED
@@ -0,0 +1,67 @@
1
+ # Enrichment
2
+
3
+ Enrichment writes custom fields to Nexthink objects through
4
+ `NexthinkClient.enrichment`.
5
+
6
+ ## Run Enrichment
7
+
8
+ ```python
9
+ from nexthink_api import (
10
+ NexthinkClient,
11
+ NxtEnrichment,
12
+ NxtEnrichmentRequest,
13
+ NxtField,
14
+ NxtFieldName,
15
+ NxtIdentification,
16
+ NxtIdentificationName,
17
+ NxtRegionName,
18
+ )
19
+
20
+ client = NexthinkClient(
21
+ instance="tenant-name",
22
+ region=NxtRegionName.eu,
23
+ client_id="client-id",
24
+ client_secret="client-secret",
25
+ )
26
+
27
+ request = NxtEnrichmentRequest(
28
+ domain="automation",
29
+ enrichments=[
30
+ NxtEnrichment(
31
+ identification=[
32
+ NxtIdentification(
33
+ name=NxtIdentificationName.DEVICE_DEVICE_NAME,
34
+ value="DEVICE-1",
35
+ )
36
+ ],
37
+ fields=[
38
+ NxtField(
39
+ name=NxtFieldName.CUSTOM_DEVICE,
40
+ value="patched",
41
+ custom_value="maintenance_status",
42
+ )
43
+ ],
44
+ )
45
+ ],
46
+ )
47
+
48
+ response = client.enrichment.run(request)
49
+ ```
50
+
51
+ ## Request Limits
52
+
53
+ `NxtEnrichmentRequest.enrichments` accepts between 1 and
54
+ `MAX_ENRICHMENTS_PER_REQUEST` objects. The constant is exported by the package
55
+ so applications can check or split their payload before creating the request.
56
+
57
+ ```python
58
+ from nexthink_api import MAX_ENRICHMENTS_PER_REQUEST
59
+
60
+ if len(enrichments) > MAX_ENRICHMENTS_PER_REQUEST:
61
+ raise ValueError(
62
+ f"Enrichment request contains more than {MAX_ENRICHMENTS_PER_REQUEST} objects"
63
+ )
64
+ ```
65
+
66
+ See [Enrichment object models](object-models/Enrichment.md) for the request and
67
+ response classes used by this domain.
docs/Nql.md ADDED
@@ -0,0 +1,34 @@
1
+ # NQL
2
+
3
+ NQL executes saved query IDs and starts exports through `NexthinkClient.nql`.
4
+
5
+ ## Execute a query
6
+
7
+ ```python
8
+ from nexthink_api import NexthinkClient, NxtNqlApiExecuteRequest, NxtRegionName
9
+
10
+ client = NexthinkClient(
11
+ instance="tenant-name",
12
+ region=NxtRegionName.eu,
13
+ client_id="client-id",
14
+ client_secret="client-secret",
15
+ )
16
+
17
+ request = NxtNqlApiExecuteRequest(queryId="#query_nql_id")
18
+ response = client.nql.execute(request, version="v2")
19
+ ```
20
+
21
+ ## Export and download
22
+
23
+ ```python
24
+ export = client.nql.export(request)
25
+ status = client.nql.wait(export, timeout=300)
26
+ download_response = client.nql.download(status)
27
+ dataframe = client.nql.download_dataframe(status)
28
+ ```
29
+
30
+ `execute()` supports `version="v1"` and `version="v2"`. New code should use
31
+ `v2` unless a tenant-specific constraint requires the historical endpoint.
32
+
33
+ See [NQL object models](object-models/Nql.md) for the request and response
34
+ classes used by this domain.
docs/RemoteActions.md ADDED
@@ -0,0 +1,52 @@
1
+ # Remote Actions
2
+
3
+ Remote Actions exposes Nexthink remote action catalog lookup and execution
4
+ through `NexthinkClient.remote_actions`.
5
+
6
+ The execution endpoint has a side effect on target devices. Keep an explicit
7
+ operator confirmation in scripts that trigger a real action.
8
+
9
+ ## List and inspect actions
10
+
11
+ ```python
12
+ from nexthink_api import NexthinkClient, NxtRegionName
13
+
14
+ client = NexthinkClient(
15
+ instance="example",
16
+ region=NxtRegionName.eu,
17
+ client_id="client-id",
18
+ client_secret="client-secret",
19
+ )
20
+
21
+ actions = client.remote_actions.list()
22
+ details = client.remote_actions.get("#remote_action_nql_id")
23
+ ```
24
+
25
+ ## Execute a remote action
26
+
27
+ ```python
28
+ from nexthink_api.RemoteActions import (
29
+ NxtRemoteActionExecutionRequest,
30
+ NxtRemoteActionTriggerInfoRequest,
31
+ )
32
+
33
+ request = NxtRemoteActionExecutionRequest(
34
+ remoteActionId="#remote_action_nql_id",
35
+ devices=["collector-uid"],
36
+ params={"argumentName": "argumentValue"},
37
+ expiresInMinutes=60,
38
+ triggerInfo=NxtRemoteActionTriggerInfoRequest(
39
+ externalSource="automation",
40
+ reason="maintenance",
41
+ externalReference="ticket-123",
42
+ ),
43
+ )
44
+
45
+ result = client.remote_actions.execute(request)
46
+ ```
47
+
48
+ `devices` accepts between 1 and 10000 collector IDs. `expiresInMinutes` must be
49
+ between 60 and 10080 when provided.
50
+
51
+ See [Remote Actions object models](object-models/RemoteActions.md) for the
52
+ request and response classes used by this domain.
docs/Spark.md ADDED
@@ -0,0 +1,62 @@
1
+ # Spark
2
+
3
+ Spark exposes conversation handoff through `NexthinkClient.spark`.
4
+
5
+ The handoff endpoint requires a target user principal name in the request
6
+ headers. The client takes it as an explicit argument so scripts do not hide
7
+ which user context is used.
8
+
9
+ ## Hand off a text message
10
+
11
+ ```python
12
+ from nexthink_api import NexthinkClient, NxtRegionName
13
+ from nexthink_api.Spark import (
14
+ NxtSparkHandoffConversationMessageRequest,
15
+ NxtSparkMessageDTO,
16
+ NxtSparkTextPartDTO,
17
+ )
18
+
19
+ client = NexthinkClient(
20
+ instance="example",
21
+ region=NxtRegionName.eu,
22
+ client_id="client-id",
23
+ client_secret="client-secret",
24
+ )
25
+
26
+ request = NxtSparkHandoffConversationMessageRequest(
27
+ message=NxtSparkMessageDTO(
28
+ parts=[NxtSparkTextPartDTO(text="Summarize the current device health.")]
29
+ ),
30
+ metadata={"source": "automation"},
31
+ )
32
+
33
+ result = client.spark.handoff(
34
+ request,
35
+ user_principal_name="user@example.com",
36
+ timezone="Europe/Paris",
37
+ )
38
+ ```
39
+
40
+ `user_principal_name` is required. `timezone` is optional and is sent as the
41
+ Spark `Timezone` header when provided.
42
+
43
+ ## Include file content
44
+
45
+ ```python
46
+ from nexthink_api.Spark import NxtSparkFilePartByContent
47
+
48
+ request = NxtSparkHandoffConversationMessageRequest(
49
+ message=NxtSparkMessageDTO(
50
+ parts=[
51
+ NxtSparkTextPartDTO(text="Analyze this CSV."),
52
+ NxtSparkFilePartByContent(
53
+ fileContent="base64-encoded-content",
54
+ mimeType="text/csv",
55
+ ),
56
+ ]
57
+ )
58
+ )
59
+ ```
60
+
61
+ See [Spark object models](object-models/Spark.md) for the request and response
62
+ classes used by this domain.
docs/Workflows.md ADDED
@@ -0,0 +1,81 @@
1
+ # Workflows
2
+
3
+ Workflows exposes Nexthink workflow metadata lookup and execution through
4
+ `NexthinkClient.workflows`.
5
+
6
+ Workflow execution has a side effect on users or devices. Keep explicit
7
+ confirmation in scripts that execute a real workflow.
8
+
9
+ ## List and inspect workflows
10
+
11
+ ```python
12
+ from nexthink_api import NexthinkClient, NxtRegionName
13
+ from nexthink_api.Workflows import NxtWorkflowDependency, NxtWorkflowTriggerMethod
14
+
15
+ client = NexthinkClient(
16
+ instance="example",
17
+ region=NxtRegionName.eu,
18
+ client_id="client-id",
19
+ client_secret="client-secret",
20
+ )
21
+
22
+ workflows = client.workflows.list(
23
+ dependency=NxtWorkflowDependency.USER,
24
+ trigger_method=NxtWorkflowTriggerMethod.API,
25
+ fetch_only_active_workflows=True,
26
+ )
27
+ details = client.workflows.get("#workflow_nql_id")
28
+ ```
29
+
30
+ ## Execute with Workflows v1
31
+
32
+ Use v1 when you already have Nexthink collector IDs for devices or SIDs for
33
+ users.
34
+
35
+ ```python
36
+ from nexthink_api.Workflows import NxtWorkflowExecutionRequest
37
+
38
+ request = NxtWorkflowExecutionRequest(
39
+ workflowId="#workflow_nql_id",
40
+ devices=["collector-uid"],
41
+ params={"inputName": "inputValue"},
42
+ )
43
+
44
+ result = client.workflows.execute(request, source="automation")
45
+ ```
46
+
47
+ ## Execute with Workflows v2 external identifiers
48
+
49
+ Use v2 when the caller naturally has external identifiers such as UPNs, device
50
+ names, device UIDs, or collector UIDs.
51
+
52
+ ```python
53
+ from nexthink_api.Workflows import (
54
+ NxtWorkflowExternalIdsExecutionRequest,
55
+ NxtWorkflowUserData,
56
+ )
57
+
58
+ request = NxtWorkflowExternalIdsExecutionRequest(
59
+ workflowId="#workflow_nql_id",
60
+ users=[NxtWorkflowUserData(upn="user@example.com")],
61
+ params={"inputName": "inputValue"},
62
+ )
63
+
64
+ result = client.workflows.execute_with_external_ids(request, source="automation")
65
+ ```
66
+
67
+ Both execution request types require at least one device or user target. Target
68
+ lists accept up to 10000 entries.
69
+
70
+ ## Trigger a thinklet
71
+
72
+ ```python
73
+ result = client.workflows.trigger_thinklet(
74
+ workflow_uuid="workflow-uuid",
75
+ execution_uuid="execution-uuid",
76
+ source="automation",
77
+ )
78
+ ```
79
+
80
+ See [Workflows object models](object-models/Workflows.md) for the request and
81
+ response classes used by this domain.
docs/examples.md ADDED
@@ -0,0 +1,161 @@
1
+ # Python Nexthink
2
+
3
+ This Python library provides a small client for the
4
+ [Nexthink API](https://docs.nexthink.com/api).
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ pip install nexthink_api
10
+ # or
11
+ uv add nexthink_api
12
+ ```
13
+
14
+ ## Source And Documentation
15
+
16
+ - [Repository source](https://github.com/ltaupiac/nexthink_api)
17
+ - [Online documentation](https://ltaupiac.github.io/nexthink_api/)
18
+ - [Official Nexthink API documentation](https://docs.nexthink.com/api)
19
+
20
+ ## Quickstart
21
+
22
+ The recommended entrypoint for new code is `NexthinkClient`. The historical
23
+ `NxtApiClient` remains available as a compatibility facade.
24
+
25
+ The examples below assume these environment variables are set:
26
+
27
+ ```bash
28
+ export nexthink_tenant="your-tenant-name"
29
+ export nexthink_region="eu"
30
+ export client_id="your-client-id"
31
+ export client_secret="your-client-secret"
32
+ ```
33
+
34
+ When running behind a corporate proxy with TLS inspection, for example Zscaler,
35
+ call `enable_truststore()` before creating the client. This enables the
36
+ operating system trust store for Nexthink HTTP calls without permanently
37
+ patching Python SSL for the whole process.
38
+
39
+ ```python
40
+ import os
41
+
42
+ from nexthink_api import NexthinkClient, NxtRegionName, enable_truststore
43
+
44
+ enable_truststore()
45
+
46
+ client = NexthinkClient(
47
+ os.environ["nexthink_tenant"],
48
+ NxtRegionName(os.getenv("nexthink_region", NxtRegionName.eu.value)),
49
+ client_id=os.environ["client_id"],
50
+ client_secret=os.environ["client_secret"],
51
+ )
52
+ ```
53
+
54
+ ### NQL Execute
55
+
56
+ The NQL query must already exist in Nexthink Administration as an API query.
57
+
58
+ ```python
59
+ import os
60
+
61
+ from nexthink_api import NxtNqlApiExecuteRequest
62
+
63
+ request = NxtNqlApiExecuteRequest(
64
+ queryId=os.environ["nexthink_nql_query_id"],
65
+ )
66
+
67
+ response = client.nql.execute(request, version="v2")
68
+ print(response.rows)
69
+ print(response.data)
70
+ ```
71
+
72
+ ### Enrichment
73
+
74
+ This example updates one custom device field for one device identified by name.
75
+
76
+ ```python
77
+ import os
78
+ from datetime import datetime
79
+
80
+ from nexthink_api import (
81
+ MAX_ENRICHMENTS_PER_REQUEST,
82
+ NxtEnrichment,
83
+ NxtEnrichmentRequest,
84
+ NxtField,
85
+ NxtFieldName,
86
+ NxtIdentification,
87
+ NxtIdentificationName,
88
+ )
89
+
90
+ identification = NxtIdentification(
91
+ name=NxtIdentificationName.DEVICE_DEVICE_NAME,
92
+ value=os.environ["nexthink_enrichment_device_name"],
93
+ )
94
+ field = NxtField(
95
+ name=NxtFieldName.CUSTOM_DEVICE,
96
+ custom_value="nexthink_api_example",
97
+ value=datetime.now().isoformat(),
98
+ )
99
+ enrichments = [NxtEnrichment(identification=[identification], fields=[field])]
100
+
101
+ if len(enrichments) > MAX_ENRICHMENTS_PER_REQUEST:
102
+ raise ValueError("Too many enrichment objects for one request")
103
+
104
+ request = NxtEnrichmentRequest(
105
+ domain=os.getenv("nexthink_enrichment_domain", "nexthink_api_example"),
106
+ enrichments=enrichments,
107
+ )
108
+
109
+ response = client.enrichment.run(request)
110
+ print(response)
111
+ ```
112
+
113
+ ### Data Management Device Deletion
114
+
115
+ The Data Management deletion API is asynchronous and destructive. Keep an
116
+ explicit confirmation in scripts and validate identifiers before calling it.
117
+
118
+ ```python
119
+ import os
120
+
121
+ from nexthink_api import NxtDeviceEntry, NxtUidValidationMode
122
+
123
+ if os.getenv("confirm_data_management_delete") != "yes":
124
+ raise SystemExit("Set confirm_data_management_delete=yes before deleting devices.")
125
+
126
+ devices = [
127
+ NxtDeviceEntry(
128
+ uid=os.environ["nexthink_device_uid"],
129
+ name=os.environ["nexthink_device_name"],
130
+ )
131
+ ]
132
+
133
+ response = client.data_management.delete_devices(
134
+ devices=devices,
135
+ request_id=os.environ["nexthink_request_id"],
136
+ uid_validation=NxtUidValidationMode.WARN,
137
+ )
138
+ print(response)
139
+ ```
140
+
141
+ ## Examples
142
+
143
+ Runnable examples are available in `examples/`:
144
+
145
+ ```bash
146
+ uv run python examples/nql_query_example.py
147
+ uv run python examples/enrichment_example.py
148
+ uv run python examples/data_management_device_deletion_example.py
149
+ uv run python examples/remote_actions_example.py
150
+ uv run python examples/campaigns_example.py
151
+ uv run python examples/workflows_example.py
152
+ uv run python examples/spark_handoff_example.py
153
+ ```
154
+
155
+ ## API Classes
156
+
157
+ Most request and response classes are Pydantic models. Use:
158
+
159
+ - `model_dump()` to serialize to a dictionary.
160
+ - `model_dump_json()` to serialize to JSON.
161
+ - `model_validate(data)` to build a model from serialized data.
docs/extra.css ADDED
@@ -0,0 +1,4 @@
1
+ div.doc.doc-object.doc-class, div.doc.doc-object.doc-function {
2
+ border-top: 1px solid #cc4333;
3
+ }
4
+
docs/index.md ADDED
@@ -0,0 +1,56 @@
1
+ # nexthink_api
2
+
3
+ Python client for the [Nexthink API](https://docs.nexthink.com/api).
4
+
5
+ ## Documentation Sources
6
+
7
+ The official Nexthink API documentation is the upstream reference:
8
+
9
+ - [Nexthink API documentation](https://docs.nexthink.com/api)
10
+ - [Nexthink API sitemap](https://docs.nexthink.com/api/sitemap.md)
11
+ - [Nexthink API LLM snapshot](https://docs.nexthink.com/api/llms-full.txt)
12
+
13
+ Runtime behavior does not depend on downloading YAML files from the Nexthink
14
+ documentation site. The package contract is defined by the Python models,
15
+ domain clients, tests, and the local `SpecRegistry`.
16
+
17
+ ## Public Client
18
+
19
+ Use `NexthinkClient` for new code:
20
+
21
+ ```python
22
+ from nexthink_api import NexthinkClient, NxtRegionName
23
+
24
+ client = NexthinkClient(
25
+ "tenant-name",
26
+ NxtRegionName.eu,
27
+ client_id="client-id",
28
+ client_secret="client-secret",
29
+ )
30
+ ```
31
+
32
+ The historical `NxtApiClient` remains available as a compatibility facade.
33
+
34
+ ## Supported Domains
35
+
36
+ - Enrichment
37
+ - NQL
38
+ - Data Management
39
+ - Remote Actions
40
+ - Campaigns
41
+ - Workflows
42
+ - Spark
43
+
44
+ ## Corporate Proxy TLS Inspection
45
+
46
+ When running behind a corporate proxy with TLS inspection, for example Zscaler,
47
+ call `enable_truststore()` before creating the client:
48
+
49
+ ```python
50
+ from nexthink_api import enable_truststore
51
+
52
+ enable_truststore()
53
+ ```
54
+
55
+ This enables the operating system trust store for Nexthink HTTP calls without
56
+ permanently patching Python SSL for the whole process.