HomeGuides
Submit Documentation FeedbackJoin Developer CommunityLog In

Budgets API handler

This topic describes the process for using the budget API handler to return a collection of budgets for the current customer.

HTTP Verb: GET

URL: /api/v1/budgets

Description: Returns a collection of budgets for the current customer

Base: HandlerBase<GetBudgetCollectionParameter, GetBudgetCollectionResult>

Handlers:

OrderHandlerDescription
500GetBudgetCollectionHandlerGets 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.
OrderHandlerDescription
500ValidateContextChecks, 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.
600GetBudgetCollectionRetrieves 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:

OrderHandlerDescription
500GetBudgetHandlerGets 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.
OrderHandlerDescription
100ValidatePunchoutIf the current session is a punchout session, returns a forbidden error.
500GetBudgetCalls 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:

OrderHandlerDescription
500UpdateBudgetHandlerUpdates budget. If requester is not signed in then handler returns error result. If both ShipToId and UserProfileId parameters specified then handler returns error result.
800UpdateBudgetPunchOutHandlerIf the current session is a punchout session then handler returns error result.
OrderHandlerDescription
100ValidatePunchoutIf the current session is a punchout session, returns a forbidden error.
500UpdateBudgetCalls 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.

📘

PunchOut references

PunchOut2Go rebranded to TradeCentric in June 2022. Code may still refer to PunchOut.


What’s Next
Did this page help you?