@pokash/n8n-nodes-optima-rest-api 1.0.2 → 1.0.4

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.
@@ -313,7 +313,7 @@ class OptimaRestApi {
313
313
  },
314
314
  json: true,
315
315
  });
316
- const token = loginResponse.accessToken;
316
+ const token = loginResponse.Token;
317
317
  for (let i = 0; i < items.length; i++) {
318
318
  try {
319
319
  if (resource === 'customer') {
@@ -321,7 +321,7 @@ class OptimaRestApi {
321
321
  const customerId = this.getNodeParameter('customerId', i);
322
322
  const response = await this.helpers.request({
323
323
  method: 'GET',
324
- url: `${gatewayUrl}/api/customer/${customerId}`,
324
+ url: `${gatewayUrl}/api/customer?id=${customerId}`,
325
325
  headers: {
326
326
  Authorization: `Bearer ${token}`,
327
327
  },
@@ -356,9 +356,11 @@ class OptimaRestApi {
356
356
  else if (operation === 'update') {
357
357
  const customerId = this.getNodeParameter('customerId', i);
358
358
  const customerData = JSON.parse(this.getNodeParameter('customerData', i));
359
+ // Add ID to the customer data for PUT request
360
+ customerData.ID = customerId;
359
361
  const response = await this.helpers.request({
360
362
  method: 'PUT',
361
- url: `${gatewayUrl}/api/customer/${customerId}`,
363
+ url: `${gatewayUrl}/api/customer`,
362
364
  headers: {
363
365
  Authorization: `Bearer ${token}`,
364
366
  },
@@ -401,7 +403,7 @@ class OptimaRestApi {
401
403
  const productId = this.getNodeParameter('productId', i);
402
404
  const response = await this.helpers.request({
403
405
  method: 'GET',
404
- url: `${gatewayUrl}/api/product/${productId}`,
406
+ url: `${gatewayUrl}/api/product?id=${productId}`,
405
407
  headers: {
406
408
  Authorization: `Bearer ${token}`,
407
409
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pokash/n8n-nodes-optima-rest-api",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "n8n node for Comarch Optima REST API integration",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",