I have REST API for my SPA application. My domain model has Order entity, it has Commission property which calculated on backend, it is number value
For get Order entity SPA calls this endpoint, this endpoint returns saved order
GET /api/orders/{id}
This endpoint returns basicly filled model for new Order
GET /api/orders/new
User fills other data and saves new Order by
POST /api/orders/
But user would like know value of Commission for Customer before Order saved, and it is problem, we call REST API when user changes several fields which connected with value of commission, but I do not undestand how to choouse name and method of this REST endpoint
For existed Order it is simple, this endpoint can calculate commission and returns it for SPA
GET /api/orders/{id}/commission
But what about not saved Order without Id? For calculating commission we need send many fields from Order model which is really complex and we can not use GET, simple way define such endpoint by POST
POST /api/calculateCommission
Or
POST /api/orders/commission
And send Order model JSON in this endpoint, but it is not REST way. What is good way for do it?