12-14-2012 11:59 AM
I see costs on order confirmation pages, but having trouble finding this data via REST. The demo system I am using has $0.0 cost everywhere. I assume it would still be available through API and returned as 0.0, but maybe I need to set actual costs to get the elements in response?
I tried pulling servicedef data by id and do not see cost. A request for serviceoffering data returns no rows. Please let me know what request would return the cost the user sees when ordering.
Thanks,
dan
Solved! Go to Solution.
01-08-2013 09:50 AM
Hello,
I think I have what you're looking for. For a given Requisiton Id, below I have 117, you can get the cost details from 2 places.
For the Requisition, there is the total expected cost:
URL:
/RequestCenter/nsapi/transaction/requisitions/id/117/
Response:
... 0.0 ...
For the invidividual items, you'll need the many Req Entries:
URL:
/RequestCenter/nsapi/transaction/requisitionentries/RequisitionNumber=117/
Response:
... 1
...0.00 0.00
Edit: Perhaps it's worth mentioning: services don't have prices, per se. *
This is because a service will often contain items that are "dynamic" or variable pricing. If you are writing a service with pricing, or editing an existing one, you can update the total for the service with the special conditional rule action "Set Price". This lets you set the price based on things like a selected instance size, service level, etc.
When a Service is bundled (as per the original screenshot), you can set the pricing for the individual bundled services. (Typically the sub-services that are bundled are summed, but there are also more options on how to cost correctly when services are bundled, see Service Designer -> Service -> Offer -> Bundle). As far as I am aware, this information is not available through the REST API.
* It is possible to set pricing information in the Service -> Offer -> Pricing tab, but I can't right now recall how it is used.
Message was edited by: Mark Swanborough
01-08-2013 09:13 AM
I have the same question. I'd also like to retrieve data on the price of services.
Regards
01-08-2013 09:50 AM
Hello,
I think I have what you're looking for. For a given Requisiton Id, below I have 117, you can get the cost details from 2 places.
For the Requisition, there is the total expected cost:
URL:
/RequestCenter/nsapi/transaction/requisitions/id/117/
Response:
... 0.0 ...
For the invidividual items, you'll need the many Req Entries:
URL:
/RequestCenter/nsapi/transaction/requisitionentries/RequisitionNumber=117/
Response:
... 1
...0.00 0.00
Edit: Perhaps it's worth mentioning: services don't have prices, per se. *
This is because a service will often contain items that are "dynamic" or variable pricing. If you are writing a service with pricing, or editing an existing one, you can update the total for the service with the special conditional rule action "Set Price". This lets you set the price based on things like a selected instance size, service level, etc.
When a Service is bundled (as per the original screenshot), you can set the pricing for the individual bundled services. (Typically the sub-services that are bundled are summed, but there are also more options on how to cost correctly when services are bundled, see Service Designer -> Service -> Offer -> Bundle). As far as I am aware, this information is not available through the REST API.
* It is possible to set pricing information in the Service -> Offer -> Pricing tab, but I can't right now recall how it is used.
Message was edited by: Mark Swanborough
01-08-2013 11:06 AM
Thanks for your reply. That'll probably help me a lot.
I'd appreciate if you could detail the following sentence you wrote in your email:
'
you can update the total for the service with the special conditional rule action "Set Price".
'
What is that "Set Price" rule action and where can it be found?
I think my problem matches the scenario you mentioned: I'd like to dynamically set the price for a service that depends on its size (the user chooses the service size from a dropdown list at the requisition form). Based on the user's choice, I'll present the price of the service right after the request submission. Makes sense?
Again, thanks for your support.
01-09-2013 11:48 AM
This is a conditional rule that you set in an Active Form Components definition.
Select your AFC and create a new "Conditional Rule"
Set your trigger or moment for running the rule in "Rule Conditions".
The next step is "Rule Actions". In here, you can find a Set Price action.
I agree with Mark: I don't think this is available via the REST API.
01-09-2013 12:39 PM
Thanks for the reply, Michael.
Another question :
At the "Define Rules Action" step, what syntax is valid for the 'result of an Expression' field ?
Regards
01-09-2013 12:58 PM
This uses the #namespace.field# format from your service, and you can do math operations. For example
#VMServiceCharge.Duration# * #VMServiceCharge.RateCost#
to multiple field "Duration" from dictionary "VMServiceCharge" by field "RateCost" from the same dictionary.
01-09-2013 01:06 PM
Thanks a lot!
Sorry if I missed something during this thread, but is this the data you guys mentioned as not being available through REST requests? The scenario is: I'm setting the price here, based on other dynamic variables set by the user, and I'd like to retrieve the price on a portlet I'll implement later. Would that be possible through REST ?
Thanks again
01-09-2013 01:23 PM
When I said you couldn't do this through the API, I meant I didn't think you could *perform* the set-cost operation that is done through the AFC.
The result of the set-cost operation might very well be available to interrogate as Mark described above. Can you try it? I haven't tried this before.
01-09-2013 01:32 PM
I'm working on it. I'l let you guys know.
Again, thanks a lot for your support. Such conversations are REALLY useful once the platform is pretty young and all of us are trying to make the most out of it.
Regards
01-10-2013 11:31 AM
Hil all
Regarding the syntax to be used at the Expression field: is it possible to have evaluation expressions there? I mean "if-else" statements, comparisons, etc.
Best regards
01-10-2013 11:33 AM
You can do that kind of thing in Rule Conditions. Not sure how they are applicable in Actions.
01-10-2013 11:41 AM
All I've seen done (and done myself) are string concatenations and basic arithmatic operations (addition, multiplication, subtraction).
Anything more complex, and you're looking at using JavaScript. (Alternatively, use basic functions available in an SQL, if the data is in existing SI's, etc.)
01-10-2013 11:47 AM
Thank you guys for the advices.
I just managed to create some rules and they work perfectly (for setting a price to a machine provisioning service, for instance). I'm writing some more code using the REST API and retrieving data about prices.
Thanks for the support.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide