Nuvem Solution icon

Nuvem Solution

Interact with Nuvem Solution API

Actions120

Cliente → Get Compras Mercadoria

AI-generated

Overview

This node integrates with the Nuvem Solution API to retrieve various types of data related to customers, products, orders, and more. Specifically, for the Cliente resource and the Get Compras Mercadoria operation, it fetches the recent merchandise purchases (parts and machines) made by a specified customer. This is useful in scenarios where you want to analyze or report on a customer's purchasing history, track buying patterns, or integrate purchase data into workflows such as CRM updates, sales analysis, or inventory management.

Practical example:
You can use this node to automatically pull the last purchases of parts and machines for a customer after a service call, enabling your system to check if the customer recently bought certain items or to trigger follow-up actions based on their purchase behavior.


Properties

Name Meaning
Cliente ID The unique identifier (number) of the customer whose merchandise purchases you want to retrieve. This is required.
Page The page number for paginated results. Defaults to 1.
Page Size The number of items to return per page. Defaults to 20.

Output

The output is a JSON array containing the list of merchandise purchases (parts and machines) associated with the specified customer. Each item in the array represents a purchase record with details as provided by the Nuvem Solution API.

The exact structure of each purchase record depends on the API response but typically includes information such as purchase date, product details, quantities, prices, and other relevant metadata.

No binary data output is produced by this operation.


Dependencies

  • Requires an API key credential for authenticating with the Nuvem Solution API.
  • The node expects the following credentials to be configured in n8n:
    • Base URL of the Nuvem Solution API
    • Software Key
    • Secret
    • User ID
    • User Key

These credentials are used to obtain an access token which authorizes subsequent API requests.


Troubleshooting

  • Authentication failures:
    If the node throws errors related to authentication, verify that all credential fields (software key, secret, user ID, user key) are correctly set and valid. Also, ensure the API base URL is correct and accessible.

  • Invalid Cliente ID:
    Providing a non-existent or incorrect customer ID will result in errors or empty responses. Confirm the customer ID exists in the system.

  • Pagination issues:
    If you request a page number beyond the available pages, the API may return an empty list. Adjust the Page and Page Size parameters accordingly.

  • Network or API errors:
    Errors like timeouts or server errors indicate connectivity or server-side problems. Retry later or check the API status.

  • Malformed input:
    Ensure numeric inputs like Cliente ID, Page, and Page Size are valid numbers.


Links and References


Summary of execute() logic for Cliente - Get Compras Mercadoria

  • Retrieves credentials and authenticates with the Nuvem Solution API to get an access token.
  • Reads input parameters: clienteId, page, and pageSize.
  • Constructs a GET request to the endpoint:
    /erp/crm/clientes/{clienteId}/comprasMercadoria?page={page}&pageSize={pageSize}
  • Sends the request with authorization header using the bearer token.
  • Returns the JSON response from the API as the node's output.

This operation supports pagination to handle large datasets efficiently.

Discussion