multicloud_rule_manager 1.0.37 → 1.0.39
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.
- package/commands/retrieve.js +19 -17
- package/package.json +1 -1
package/commands/retrieve.js
CHANGED
|
@@ -40,25 +40,27 @@ export default {
|
|
|
40
40
|
|
|
41
41
|
// --- SECONDA CHIAMATA: retrieve ---
|
|
42
42
|
console.log("🔹 Inizio richiesta dati API...");
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
const apiResp = await fetch(
|
|
44
|
+
`https://${cred.realm}.cloud/api/data/v1/rules`,
|
|
45
|
+
{
|
|
46
|
+
method: "GET",
|
|
47
|
+
headers: {
|
|
48
|
+
"Authorization": `Bearer ${access_token}`,
|
|
49
|
+
"Accept": "application/json"
|
|
50
|
+
},
|
|
51
|
+
redirect: "manual"
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
if (!apiResp.ok) {
|
|
56
|
+
const errText = await apiResp.text();
|
|
57
|
+
throw new Error(`Errore API ${apiResp.status}: ${errText}`);
|
|
58
|
+
}
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
const data = await apiResp.json();
|
|
61
|
+
console.log("🔹 API status:", apiResp.status);
|
|
62
|
+
|
|
63
|
+
|
|
62
64
|
|
|
63
65
|
console.log("🔹 API final URL:", data.url);
|
|
64
66
|
|