cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
920
Views
0
Helpful
13
Replies

Is cost available from REST?

devmandan
Beginner
Beginner

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

SnapshotCost.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

Mark Swanborough
Cisco Employee
Cisco Employee

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

View solution in original post

13 REPLIES 13

otavio.augusto
Beginner
Beginner

I have the same question. I'd also like to retrieve data on the price of services.

Regards

Mark Swanborough
Cisco Employee
Cisco Employee

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

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.

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.

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

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.

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

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.

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

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

You can do that kind of thing in Rule Conditions.  Not sure how they are applicable in Actions.

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.)

otavio.augusto
Beginner
Beginner

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.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: