Skip to content

pos-list-upsell-products

Method: GET
Path: /pos/catalog/products/up-sell

Tags: POS

Summary

Retrieve up-sell products

Description

Retrieves a list of products specified for upsell. The upsell products are returned based on product ids specified in request param.

Pos SDK Usage

SDK Method: pos.listUpsellProducts()

Example:

typescript
// Basic usage - get up-sell products for cart items
const { data, error } = await pos.listUpsellProducts({
  product_ids: ["prod_01H9XYZ12345ABCDE"]
});

// Advanced usage with pagination and custom sorting
const { data, error } = await pos.listUpsellProducts({
  product_ids: ["prod_01H9XYZ12345ABCDE"],
  page: 1,
  limit: 15,
  sort_by: '{"relevance":"desc"}'
});

// Override customer group ID for this specific request
const { data, error } = await pos.listUpsellProducts(
  {
    product_ids: ["prod_01H9XYZ12345ABCDE"],
    page: 1,
    limit: 15
  },
  {
    "x-customer-group-id": "01H9XYZ12345USERID" // Override default SDK config
  }
);

if (error) {
  console.error("Failed to get up-sell products:", error.message);
} else {
  console.log("Up-sell products found:", data.products.length);
  console.log("Pagination:", data.pagination);
  data.products.forEach(product => {
    console.log(`Up-sell: ${product.name} - ${product.price}`);
  });
}

TypeScript Definition

typescript
"pos-list-upsell-products": {
        parameters: {
            query?: {
                /** @description no of rows per page */
                limit?: number;
                /** @description page number in pagination */
                page?: number;
                /** @description Product ids of cart items */
                product_id?: string[];
                /** @description json to sort records */
                sort_by?: string;
            };
            header?: {
                /** @description This param is used to determine product pricing, promotions, and subscription rates.  If a valid customer group id is provided, pricing details will be retrieved accordingly.  If no matching data is found for the specified customer group id, the system will fall back to the default customer group id.  If no data is found for the default group either, the highest applicable price will be returned. */
                "x-customer-group-id"?: components["parameters"]["CustomerGroupId"];
            };
            path?: never;
            cookie?: never;
        };
        requestBody?: never;
        responses: {
            /** @description Success response */
            200: {
                headers: {
                    [name: string]: unknown;
                };
                content: {
                    "application/json": {
                        /** @description Masssage */
                        message: string;
                        success: boolean;
                        content: {
                            products: components["schemas"]["Item"][];
                            pagination: components["schemas"]["Pagination"];
                        };
                    };
                };
            };
            401: components["responses"]["Unauthorized"];
            404: components["responses"]["NotFound"];
        };
    };

Component References

ReferenceResolves To
components["parameters"]["CustomerGroupId"]CustomerGroupId
components["schemas"]["Item"]Item
components["schemas"]["Pagination"]Pagination
components["responses"]["Unauthorized"]Unauthorized
components["responses"]["NotFound"]NotFound

Parameters

  • x-customer-group-id (header): This param is used to determine product pricing, promotions, and subscription rates. If a valid customer group id is provided, pricing details will be retrieved accordingly. If no matching data is found for the specified customer group id, the system will fall back to the default customer group id. If no data is found for the default group either, the highest applicable price will be returned.
  • limit (query): no of rows per page
  • page (query): page number in pagination
  • product_id (query): Product ids of cart items
  • sort_by (query): json to sort records

Responses

200

Success response

401

Not authorized for given operation on the Resource

404

Requested resource not found

OpenAPI Definition

json
{
  "tags": [
    "POS"
  ],
  "operationId": "pos-list-upsell-products",
  "summary": "Retrieve up-sell products",
  "description": "Retrieves a list of products specified for upsell. The upsell products are returned based on product ids specified in request param.",
  "parameters": [
    {
      "$ref": "#/components/parameters/CustomerGroupId"
    },
    {
      "name": "limit",
      "in": "query",
      "description": "no of rows per page",
      "schema": {
        "type": "integer"
      }
    },
    {
      "name": "page",
      "in": "query",
      "description": "page number in pagination",
      "schema": {
        "type": "integer"
      }
    },
    {
      "name": "product_id",
      "in": "query",
      "description": "Product ids of cart items",
      "schema": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    },
    {
      "name": "sort_by",
      "in": "query",
      "description": "json to sort records",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Success response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "message",
              "success",
              "content"
            ],
            "properties": {
              "message": {
                "description": "Masssage",
                "type": "string"
              },
              "success": {
                "type": "boolean"
              },
              "content": {
                "properties": {
                  "products": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/Item"
                    }
                  },
                  "pagination": {
                    "$ref": "#/components/schemas/Pagination"
                  }
                },
                "required": [
                  "products",
                  "pagination"
                ],
                "type": "object"
              }
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  },
  "security": [
    {
      "Authorization": []
    }
  ],
  "x-speakeasy-group": "pos",
  "x-speakeasy-ignore": true,
  "x-speakeasy-name-override": "listUpsellProducts"
}

Auto-generated from OpenAPI spec and TypeScript definitions

Last updated: