NinjaOne icon

NinjaOne

Consume NinjaOne API

Actions158

Management → Create Policy

AI-generated

Overview

This node integrates with the NinjaOne API to manage policies within the "Management" resource. Specifically, the "Create Policy" operation allows users to create new policies in different modes (new, child, or copy) and configure various attributes such as name, description, node class, and enabled status.

Use cases include automating policy creation workflows for IT asset management, security compliance, or configuration management across diverse device types and environments. For example, an IT administrator can use this node to programmatically create a new Windows Server policy or clone an existing policy as a child policy, streamlining policy deployment at scale.

Properties

Name Meaning
Mode Policy creation mode. Options: NEW, CHILD, COPY
Template Policy Id Identifier of the template policy used when creating a policy (number).
Parent Policy Id Identifier of the parent policy if creating a child policy (number).
Name The name of the policy (string).
Description A textual description of the policy (string).
Node Class The classification of nodes/devices the policy applies to. Options include WINDOWS_SERVER, LINUX_SERVER, MAC, ANDROID, various NMS device types, etc.
Enabled Boolean flag indicating whether the policy is enabled or disabled.

Output

The node outputs JSON data representing the response from the NinjaOne API after attempting to create the policy. This typically includes details of the newly created policy such as its ID, status, and other metadata returned by the API.

No binary data output is produced by this operation.

Dependencies

  • Requires an OAuth2 API credential configured for authenticating with the NinjaOne API.
  • The node uses the NinjaOne REST API endpoints under /v2/policies for policy management.
  • Proper network access and permissions to the NinjaOne API are necessary.

Troubleshooting

  • Common issues:
    • Missing or invalid API credentials will cause authentication failures.
    • Providing invalid or incomplete property values (e.g., missing required fields like name) may result in API errors.
    • Using an unsupported mode or mismatched templatePolicyId/parentPolicyId combinations could cause request rejections.
  • Error messages:
    • Errors from the NinjaOne API will be surfaced in the node output under an error object if "Continue On Fail" is enabled.
    • Typical errors include HTTP 400 for bad requests, 401 for unauthorized access, and 404 if referenced policies do not exist.
  • Resolution tips:
    • Verify all required properties are set correctly.
    • Ensure the API credential is valid and has sufficient permissions.
    • Check that referenced IDs (template or parent policy) exist and are accessible.

Links and References

Discussion