Loading...
Area: Optimizely B2B Commerce

Budgets API handler

Recommended reading 

HTTP Verb: GET

URL: /api/v1/budgets

Description: Returns a collection of budgets for the current customer

Base: HandlerBase<GetBudgetCollectionParameter, GetBudgetCollectionResult>

Handlers:

Order Handler

Description

500 GetBudgetCollectionHandler

Gets budget collection. If requester is not signed in then handler returns error result. If both ShipToId and UserProfileId parameters specified then handler returns error result.

Order Handler

Description

500 ValidateContext Checks, if BillTo in site context is not null, otherwise returns error. Then tries to find ShipTo by ShipToId parameter and UserProfile by UserProfileId parameter, if none of them is found returns NotSupported error.
600 GetBudgetCollection Retrieves GetBudgetResults by getting BudgetCalendar for BillTo from result with filtering by FiscalYear parameter or all. For each budget result GetCustomerBudgetReview budget pipeline is being called. Currency is being set from BillTo property or website default (if BillTo currency is not set).

HTTP Verb: GET

URL: /api/v1/budgets/{fiscalYear}

Description: Returns a single budget by fiscal year and current customer

Base: HandlerBase<GetBudgetParameter, GetBudgetResult>

Handlers:

Order Handler

Description

500 GetBudgetHandler

Gets budget. If requester is not signed in then handler returns error result. If GetCalendar parameter specified then handler also returns budget calendar in result. If GetReviews parameter specified then handler also returns customer reviews for budget in result.

Order Handler

Description

100 ValidatePunchout If the current session is a punchout session, returns a forbidden error.
500 GetBudget Calls GetBudgetCollection with FiscalYear, ShipToId, UserProfileId and GetBudgetActualAmounts parameters. If GetBudgetResults count is not equals to 1, then returns not found, otherwise gets first item.

HTTP Verb: PATCH

URL: /api/v1/budgets/{fiscalYear}

Description: Update a single budget by fiscal year and current customer

Base: HandlerBase<UpdateBudgetParameter, UpdateBudgetResult>

Handlers:

Order Handler

Description

500 UpdateBudgetHandler Updates budget. If requester is not signed in then handler returns error result. If both ShipToId and UserProfileId parameters specified then handler returns error result.
800 UpdateBudgetPunchOutHandler

If the current session is a punchout session then handler returns error result.

Order Handler

Description

100 ValidatePunchout If the current session is a punchout session, returns a forbidden error.
500 UpdateBudget Calls GetBudget with FiscalYear, ShipToId, UserProfileId parameters and GetBudgetActualAmounts with false value. Tries to load CustomerBudget with current BillTo, FiscalYear parameter, then shipToId and userProfileId from GetBudget result, if not exists - create new CustomerBudget and inserts into database. If Budgets parameter is set - SetPeriodBudgets extention method is being called.
Do you find this information helpful? Please log in to provide feedback.

Last updated: Dec 11, 2020

Recommended reading