Skip to content

Commit 54e70db

Browse files
committed
Add iTop CMDB integration node with authentication and core operations
- Implement iTop node with get and update operations - Add ITopApi credentials supporting username/password and token authentication - Update README with iTop-specific documentation and setup instructions - Configure package.json with iTop metadata and n8n node registration - Support iTop REST/JSON API with OQL queries and object manipulation
1 parent 99c68a5 commit 54e70db

File tree

10 files changed

+707
-42
lines changed

10 files changed

+707
-42
lines changed

README.md

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# n8n-nodes-itop
22

3-
This is an n8n community node. It lets you use GitHub Issues in your n8n workflows.
3+
This is an n8n community node. It lets you use iTop CMDB in your n8n workflows.
44

55
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
66

77
[Installation](#installation)
88
[Operations](#operations)
99
[Credentials](#credentials)
1010
[Compatibility](#compatibility)
11-
[Usage](#usage)
1211
[Resources](#resources)
1312

1413
## Installation
@@ -17,51 +16,41 @@ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes
1716

1817
## Operations
1918

20-
- Issues
21-
- Get an issue
22-
- Get many issues in a repository
23-
- Create a new issue
24-
- Issue Comments
25-
- Get many issue comments
19+
- **Get**: Search for and retrieve iTop objects using OQL queries or object IDs
20+
- **Update**: Update a single iTop object with new field values
2621

2722
## Credentials
2823

29-
You can use either access token or OAuth2 to use this node.
24+
You can use either username/password or token-based authentication to use this node.
3025

31-
### Access token
26+
### Setting up credentials in n8n
3227

33-
1. Open your GitHub profile [Settings](https://github.com/settings/profile).
34-
2. In the left navigation, select [Developer settings](https://github.com/settings/apps).
35-
3. In the left navigation, under Personal access tokens, select Tokens (classic).
36-
4. Select Generate new token > Generate new token (classic).
37-
5. Enter a descriptive name for your token in the Note field, like n8n integration.
38-
6. Select the Expiration you'd like for the token, or select No expiration.
39-
7. Select Scopes for your token. For most of the n8n GitHub nodes, add the `repo` scope.
40-
- A token without assigned scopes can only access public information.
41-
8. Select Generate token.
42-
9. Copy the token.
28+
1. In n8n, go to **Credentials** and create a new **iTop API** credential
29+
2. Enter your **iTop URL** (e.g., `https://your-itop-instance.com`)
30+
3. Select your **Authentication Method**:
4331

44-
Refer to [Creating a personal access token (classic)](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic) for more information. Refer to Scopes for OAuth apps for more information on GitHub scopes.
32+
### Username and Password
4533

46-
![Generated Access token in GitHub](https://docs.github.com/assets/cb-17251/mw-1440/images/help/settings/personal-access-tokens.webp)
34+
1. Select **Username and Password** as the authentication method
35+
2. Enter your iTop **Username**
36+
3. Enter your iTop **Password**
37+
4. Optionally adjust the **API Version** (default: 1.3)
4738

48-
### OAuth2
39+
### Token
4940

50-
If you're self-hosting n8n, create a new GitHub [OAuth app](https://docs.github.com/en/apps/oauth-apps):
41+
1. Select **Token** as the authentication method
42+
2. Enter your iTop **Auth Token**
43+
- To generate a token in iTop, go to **User Account** > **Personal Tokens**
44+
3. Optionally adjust the **API Version** (default: 1.3)
5145

52-
1. Open your GitHub profile [Settings](https://github.com/settings/profile).
53-
2. In the left navigation, select [Developer settings](https://github.com/settings/apps).
54-
3. In the left navigation, select OAuth apps.
55-
4. Select New OAuth App.
56-
- If you haven't created an app before, you may see Register a new application instead. Select it.
57-
5. Enter an Application name, like n8n integration.
58-
6. Enter the Homepage URL for your app's website.
59-
7. If you'd like, add the optional Application description, which GitHub displays to end-users.
60-
8. From n8n, copy the OAuth Redirect URL and paste it into the GitHub Authorization callback URL.
61-
9. Select Register application.
62-
10. Copy the Client ID and Client Secret this generates and add them to your n8n credential.
46+
### Required iTop Permissions
6347

64-
Refer to the [GitHub Authorizing OAuth apps documentation](https://docs.github.com/en/apps/oauth-apps/using-oauth-apps/authorizing-oauth-apps) for more information on the authorization process.
48+
Users need the following permissions in iTop:
49+
- **REST Services User** profile
50+
- **Write access** on the classes they want to modify
51+
- **Bulk write** permissions on the classes they want to modify
52+
53+
Note: Standard administrator accounts do not have REST access by default unless the REST Services User profile is explicitly granted.
6554

6655
## Compatibility
6756

@@ -70,4 +59,4 @@ Compatible with n8n@1.60.0 or later
7059
## Resources
7160

7261
* [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
73-
* [GitHub API docs](https://docs.github.com/en/rest/issues)
62+
* [iTop REST/JSON API documentation](https://www.itophub.io/wiki/page?id=latest:advancedtopics:rest_json)

credentials/ITopApi.credentials.ts

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import type {
2+
IAuthenticateGeneric,
3+
ICredentialTestRequest,
4+
ICredentialType,
5+
INodeProperties,
6+
} from 'n8n-workflow';
7+
8+
export class ITopApi implements ICredentialType {
9+
name = 'iTopApi';
10+
11+
displayName = 'iTop API';
12+
13+
documentationUrl = 'https://www.itophub.io/wiki/page?id=latest:advancedtopics:rest_json';
14+
15+
properties: INodeProperties[] = [
16+
{
17+
displayName: 'iTop URL',
18+
name: 'url',
19+
type: 'string',
20+
default: '',
21+
placeholder: 'https://your-itop-instance.com',
22+
description: 'The base URL of your iTop instance (without /webservices/rest.php)',
23+
required: true,
24+
},
25+
{
26+
displayName: 'Username',
27+
name: 'username',
28+
type: 'string',
29+
default: '',
30+
required: true,
31+
},
32+
{
33+
displayName: 'Password',
34+
name: 'password',
35+
type: 'string',
36+
typeOptions: { password: true },
37+
default: '',
38+
required: true,
39+
},
40+
{
41+
displayName: 'API Version',
42+
name: 'version',
43+
type: 'string',
44+
default: '1.3',
45+
description: 'The iTop REST API version to use',
46+
},
47+
];
48+
49+
authenticate: IAuthenticateGeneric = {
50+
type: 'generic',
51+
properties: {},
52+
};
53+
54+
test: ICredentialTestRequest = {
55+
request: {
56+
baseURL: '={{$credentials.url}}/webservices/rest.php',
57+
url: '?version={{$credentials.version}}',
58+
method: 'POST',
59+
headers: {
60+
'Content-Type': 'application/x-www-form-urlencoded',
61+
},
62+
body: {
63+
json_data: '={{ JSON.stringify({ operation: "core/check_credentials" }) }}',
64+
auth_user: '={{$credentials.username}}',
65+
auth_pwd: '={{$credentials.password}}',
66+
},
67+
},
68+
rules: [
69+
{
70+
type: 'responseSuccessBody',
71+
properties: {
72+
key: 'authorized',
73+
value: true,
74+
message: 'Authentication failed. Please check your username and password.',
75+
},
76+
},
77+
],
78+
};
79+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import type {
2+
IAuthenticateGeneric,
3+
ICredentialTestRequest,
4+
ICredentialType,
5+
INodeProperties,
6+
} from 'n8n-workflow';
7+
8+
export class ITopTokenApi implements ICredentialType {
9+
name = 'iTopTokenApi';
10+
11+
displayName = 'iTop Token API';
12+
13+
documentationUrl = 'https://www.itophub.io/wiki/page?id=latest:advancedtopics:rest_json';
14+
15+
properties: INodeProperties[] = [
16+
{
17+
displayName: 'iTop URL',
18+
name: 'url',
19+
type: 'string',
20+
default: '',
21+
placeholder: 'https://your-itop-instance.com',
22+
description: 'The base URL of your iTop instance (without /webservices/rest.php)',
23+
required: true,
24+
},
25+
{
26+
displayName: 'Auth Token',
27+
name: 'authToken',
28+
type: 'string',
29+
typeOptions: { password: true },
30+
default: '',
31+
required: true,
32+
description: 'Personal or application token from iTop',
33+
},
34+
{
35+
displayName: 'API Version',
36+
name: 'version',
37+
type: 'string',
38+
default: '1.3',
39+
description: 'The iTop REST API version to use',
40+
},
41+
];
42+
43+
authenticate: IAuthenticateGeneric = {
44+
type: 'generic',
45+
properties: {},
46+
};
47+
48+
test: ICredentialTestRequest = {
49+
request: {
50+
baseURL: '={{$credentials.url}}/webservices/rest.php',
51+
url: '?version={{$credentials.version}}',
52+
method: 'POST',
53+
headers: {
54+
'Content-Type': 'application/x-www-form-urlencoded',
55+
},
56+
body: {
57+
json_data: '={{ JSON.stringify({ operation: "core/check_credentials" }) }}',
58+
auth_token: '={{$credentials.authToken}}',
59+
},
60+
},
61+
rules: [
62+
{
63+
type: 'responseSuccessBody',
64+
properties: {
65+
key: 'authorized',
66+
value: true,
67+
message: 'Authentication failed. Please check your token.',
68+
},
69+
},
70+
],
71+
};
72+
}

0 commit comments

Comments
 (0)