-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtulip_api_auth.html
124 lines (117 loc) · 4 KB
/
tulip_api_auth.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<script type="text/javascript">
RED.nodes.registerType('tulip-api-auth', {
category: 'config',
paletteLabel: 'tulip-api-auth',
defaults: {
name: { value: 'tulip-api-auth' },
protocol: {
value: 'https',
required: true,
},
hostname: {
value: '',
required: true,
validate: function (name) {
// Note: this also covers IP addresses.
const validHostname = new RegExp(
'^\\w+([.-]\\w+)*$',
);
return validHostname.test(name);
},
},
port: {
value: null,
required: false,
validate: function (port) {
return port >= 0 && port <= 65535;
},
},
},
credentials: {
apiKey: { type: 'text' },
apiSecret: { type: 'password' },
},
label: function () {
return this.name || 'tulip-api-auth';
},
});
</script>
<script type="text/html" data-template-name="tulip-api-auth">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-config-input-name" placeholder="Name" />
</div>
<div class="form-row">
<label for="node-config-input-protocol"><i class="fa fa-globe"></i> Protocol</label>
<select id="node-config-input-protocol">
<option value="https">https</option>
<option value="http">http</option>
</select>
</div>
<div class="form-row">
<label for="node-config-input-hostname"><i class="fa fa-link"></i> Factory URL</label>
<input
type="text"
id="node-config-input-hostname"
placeholder="i.e. [your-subdomain].tulip.co"
/>
</div>
<div class="form-row">
<label for="node-config-input-port"> Port (optional)</label>
<input
type="number"
step="1"
id="node-config-input-port"
min="0"
max="65535"
placeholder="default: 80 (HTTP) or 443 (HTTPS)"
/>
</div>
<div class="form-row">
<label for="node-config-input-apiKey"><i class="fa fa-user-circle"></i> API Key</label>
<input type="text" id="node-config-input-apiKey" placeholder="apikey.2_" />
</div>
<div class="form-row">
<label for="node-config-input-apiSecret"><i class="fa fa-key"></i> API Secret</label>
<input type="password" id="node-config-input-apiSecret" />
</div>
<div class="form-tips">
<p><b>Tip:</b> To generate an API token, you can visit:</p>
<ul>
<li>Workspaces enabled: <a>https://[your-factory-url]/settings/api-tokens</a></li>
<li>Workspaces not enabled: <a>https://[your-factory-url]/account-settings/api-tokens</a></li>
</ul>
<p>
and create an API token with the correct permissions. Make sure to write down the API Secret in a
secure location, since you won't be able to view it again.
</p>
</div>
</script>
<script type="text/html" data-help-name="tulip-api-auth">
<p>Configures authentication for the Tulip API.</p>
<h3>Details</h3>
<p>
Each <code>tulip-api-auth</code> node configures authentication for using the Tulip API.
The API credentials should be for an API token on the specified factory instance that has the correct permissions to
make the specified API calls. Each authentication node can be shared between multiple Tulip API nodes.
</p>
<p>
To use the Tulip API, you will first need to create an API token by visiting:
</p>
<ul>
<li>Workspaces enabled: <a>https://[your-factory-url]/settings/api-tokens</a></li>
<li>Workspaces not enabled: <a>https://[your-factory-url]/account-settings/api-tokens</a></li>
</ul>
<p>
Make sure to write down the API Secret in a secure location, since you won't be able to view it again.
</p>
<h3>References</h3>
<ul>
<li>
<a href=https://support.tulip.co/en/articles/4896233-using-node-red-with-edge-mc><b>Using Node-RED with Edge MC</b></a>
</li>
<li>
<b>Tulip API Documentation:</b> available at <a>https://[your-factory-url]/apiDocs</a>.
</li>
</ul>
</script>