Ucommerce
  • Ucommerce Next Gen
    • Getting Started
      • Prerequisites
      • Licensing
      • Ucommerce Templates
      • Headless Template
      • MVC Template
    • Headless
      • Postman Collection
      • Headless API Authentication
        • Token endpoint - Authorization Header
        • Authorization Scopes
        • Refreshing the Access Token
      • Reference
        • Cart
        • Cart / Order Line Items
        • Shipment
        • Billing
        • Promotion Codes
        • Price Groups
        • Payment Methods
        • Countries
        • Shipping Methods
        • Catalogs
        • Cart Custom Properties
        • Line Item Custom Properties
        • Orders
        • Views for Cart modifying operations
      • Custom Headless APIs
      • Error Handling
      • Pagination
      • Deprecation
    • Backoffice Authentication
      • Microsoft Entra ID Example
      • Auth0 Authentication Example
    • Definitions
      • What is a Definition
    • Search and indexing
      • Configuration
      • Indexing
        • Index Definitions
        • Facets
        • Indexing Prices
        • Suggestions
        • Custom Data
      • Searching
    • Payment Providers
      • Stripe Provider Integration
      • Implementing a custom payment provider
    • Data Import
    • Miscellaneous
      • Media
      • Price Group Inheritance
      • Price Group Criteria
      • Soft Deletion Of Entities
      • Logging
      • OpenTelemetry
    • Extensions
      • Extending Pipelines
        • Order Processing Pipelines
        • Checkout Pipelines
      • Changing Service Behavior
        • Images
        • Content
      • Custom Headless APIs
      • Extend the Backoffice
        • Custom UI Components
      • Custom Editor UI
      • Custom Promotion Criteria
      • Custom Price Group Criteria
    • How-To
      • Migrate from Classic
        • Common database issues
      • Entities from code
        • Bootstrapping data on startup
        • Product Definitions & Fields
      • Discover pipelines and their tasks
      • Executing a pipeline
    • Integrations
      • Umbraco Media Delivery API
      • App Slices
        • Product Picker
  • Release Notes
  • Contact Us
Powered by GitBook
On this page
  • Prerequisites
  • Get Price Groups
  • Optional Parameters
  • Request
  • Response
  • Error Handling
  • Filtering Valid Price Groups
  • Related Articles

Was this helpful?

  1. Ucommerce Next Gen
  2. Headless
  3. Reference

Price Groups

PreviousPromotion CodesNextPayment Methods

Last updated 6 months ago

Was this helpful?

Prerequisites

  • An access_token from Headless API Authentication

  • A cultureCode, e.g., en-US (string)

Get Price Groups

Optional Parameters

  • maxItems, limits the number of results returned. in Pagination

  • nextPagingToken, required to fetch the next page. Read more in Pagination

  • filters-*, used for for valid price groups based on .

Request

curl -D- -X GET <base_url>/api/v1/price-groups?cultureCode=<cultureCode>&maxItems=<maxItems>&nextPagingToken=<nextPagingToken> \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json'

Response

{
    "nextPagingToken": null,
    "priceGroups": [
        {  
            id: "{id}",
            name: "{priceGroupsName}"
        }
    ]
}

Error Handling

Error
Description

BadRequest (400)

Invalid access token; Invalid culture code etc.

Unauthorized (401)

The token is expired.

Forbidden (403)

The token does not have access to this endpoint.

Error Response Example

{
"errors":
    [
        {
            "error-description": "Invalid cultureCode.",
            "error": "BadRequest"
        }
    ]
}

Filtering Valid Price Groups

To get the valid price groups for a context, this endpoint supports giving it a set of properties prefixed with filters-. Setting any filter property will make the API only return price groups that are valid according to the criteria set up for them. The API will map any parameters prefixed filters- to a dictionary of properties, sent to the GetPriceGroups pipeline, in the following way: The parameter name will be mapped to the key in the dictionary, with the filters- part of the name stripped off. The parameter value will be mapped to the value in the dictionary.

curl -D- -X GET <base_url>/api/v1/price-groups?filters-customer=29ae4d70-f0dd-4eca-83bf-7125920f3279&cultureCode=<cultureCode>&maxItems=<maxItems>&nextPagingToken=<nextPagingToken> \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json'

In the above example, we're calling the API with a filters-customer query parameter. The key will be customer and the value will be 29ae4d70-f0dd-4eca-83bf-7125920f3279 - the GUID of the current customer.

This can be used to send filtering properties used by either the built-in criteria, or your custom criteria. The built-in criteria uses the following keys:

  • Key customer - Validates the customer against all customer group or organization criteria.

    • Value: Guid of the customer

  • Key customerGroup - Validates the customer group against all customer group criteria.

    • Value: Guid of the customer group

  • Key organization - Validates the organization against all organization criteria.

    • Value: Guid of the organization

The time-based criterion doesn't use any properties as it is validated via server time. This means, that, if no other filter properties are needed, you will need to add an unused filter property, e.g. filters-time= to trigger the filtering.

If any filtering properties are given, all criteria will be checked. This means that even if the only filtering property sent is a customer guid, all time-based criteria will also influence the filtering.

Related Articles

See the for more details on how to use the properties in a pipeline task.

guide on extending price group criteria
Error Handling
price group criteria
filtering