@pokash/n8n-nodes-optima-rest-api 1.1.0 → 1.1.1
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.
Potentially problematic release.
This version of @pokash/n8n-nodes-optima-rest-api might be problematic. Click here for more details.
|
@@ -351,19 +351,19 @@ class OptimaRestApi {
|
|
|
351
351
|
if (resource === 'customer') {
|
|
352
352
|
if (operation === 'get' || operation === 'getAll') {
|
|
353
353
|
const options = this.getNodeParameter('options', i, {});
|
|
354
|
-
// Build query parameters
|
|
354
|
+
// Build query parameters (use PascalCase to match C# API)
|
|
355
355
|
const queryParams = new URLSearchParams();
|
|
356
356
|
if (options.id) {
|
|
357
|
-
queryParams.append('
|
|
357
|
+
queryParams.append('Id', String(options.id));
|
|
358
358
|
}
|
|
359
359
|
if (options.filter) {
|
|
360
|
-
queryParams.append('
|
|
360
|
+
queryParams.append('Filter', String(options.filter));
|
|
361
361
|
}
|
|
362
362
|
if (options.skip) {
|
|
363
|
-
queryParams.append('
|
|
363
|
+
queryParams.append('Skip', String(options.skip));
|
|
364
364
|
}
|
|
365
365
|
if (options.take) {
|
|
366
|
-
queryParams.append('
|
|
366
|
+
queryParams.append('Take', String(options.take));
|
|
367
367
|
}
|
|
368
368
|
const queryString = queryParams.toString();
|
|
369
369
|
const url = queryString
|
|
@@ -377,13 +377,20 @@ class OptimaRestApi {
|
|
|
377
377
|
},
|
|
378
378
|
json: true,
|
|
379
379
|
});
|
|
380
|
-
//
|
|
381
|
-
|
|
382
|
-
|
|
380
|
+
// API returns { Success: true, Customers: [...], TotalCount: ... }
|
|
381
|
+
const responseData = response;
|
|
382
|
+
// Extract customers array from response
|
|
383
|
+
if (responseData.Customers && Array.isArray(responseData.Customers)) {
|
|
384
|
+
const items = responseData.Customers.map(item => ({ json: item }));
|
|
383
385
|
returnData.push(...items);
|
|
384
386
|
}
|
|
387
|
+
else if (responseData.Customers) {
|
|
388
|
+
// Single customer
|
|
389
|
+
returnData.push({ json: responseData.Customers });
|
|
390
|
+
}
|
|
385
391
|
else {
|
|
386
|
-
|
|
392
|
+
// Fallback - return entire response if structure is unexpected
|
|
393
|
+
returnData.push({ json: responseData });
|
|
387
394
|
}
|
|
388
395
|
}
|
|
389
396
|
else if (operation === 'create') {
|