1 billing transaction is 32 API calls

Not applicable

Hi there,

I was wondering if there a way to automate some billing transaction calculation in Apigee.

Currently our Licensing department takes the usage data (number of API calls per apikey and month) from Apigee, does some magic, and invoices the big enterprise customers based on the B2B contract signed.

In most cases, the customer pays per API calls. We say that 1 billing transaction is 1 API call.

But we have some APIs for which 1 billing transaction = 32 API calls. (the customer pays for 32 API calls not for a single API call).

Part of the magic the Licensing team does: in order to calculate the number of billing transactions, they take the usage data in the excel and divide the number of API calls to 32. Is there a way to configure Apigee so that I do not have to make the division to 32 in excel?

Also: a customer pays only for 2xx and 3xx calls, not for the server error responses. Can I also configure Apigee to put in the billing reports only the 2xx and 3xx calls?

CC-ing: @Srinivas Sudhindra, @akhimich

Thank you,

Emilia

Solved Solved
1 10 720
1 ACCEPTED SOLUTION

rajanish
Participant III

Hi Emilia,

We had a similar question asked in community earlier - https://community.apigee.com/questions/19377/can-i-set-up-something-like-x-number-of-requests-1.html

let us know if you have questions

View solution in original post

10 REPLIES 10

@Emilia Ipate , How do you get usage data from Apigee ? Using Analytics ? Using APIs ? If you can access same data via APIs, You can create an API Proxy which does this division of total / 32. As far as i know, Apigee has API first strategy, the data you are talking about should be available as API. Keep us posted how you are getting Usage Data from Apigee, that will hold answer to your query above. Hope it helps. Keep us posted if any.

rajanish
Participant III

Hi Emilia,

We had a similar question asked in community earlier - https://community.apigee.com/questions/19377/can-i-set-up-something-like-x-number-of-requests-1.html

let us know if you have questions

@rajanish The answer provided in thd link you gave is not clear for me and it doesn't seem to answer the question.

@Emilia Ipate that is exactly your example.

Transactio Recording policy can be configured to have conditions like

txProviderStatus=='OK' OR txProviderStatus=='MOVED'

Then you can setup 2 rate plans

RatePlan A - where each call = 1 business transaction (the usage will be incremented by +1)

RatePlan B with custom attribute - in this example proxy sends CA='0.03125' ( 1/32 value) in this case each api proxy call will increment usage by +0.03125. 32 such calls = increment +1.

Reports will show you the decimal usage.

You can read more here

@akhimich, I tried the idea with RateCard with customAttribute, but it's not working. Can you please point out what am I missing?

In my example, I assumed that 1 billable transaction = 2 API calls just so that I can easier calculate that it works.

What I did:

1. I set customAttribute in transactionRecordingPolicy

3288-customattributeintransactionrecordingpolicy.png

2. I create a Rate Card with customAttribute

3289-ratecardwithcustomattribute.png

3. I published and accepted the Rate Plan

curl -X POST -H "Authentication: Bearer YWM...A8E" -H "Content-Type: application/json" -H "Authorization: Basic ZW1...UA=" -H "Cache-Control: no-cache" -H "Postman-Token: 57...cc" -d '{ "developer":{ "id":"emilia4.ipate@gmail.com" }, "startDate":"2016-08-03", "ratePlan":{ "id":"notargettwo-cxr9_prod_2_calls_weight" }, "suppressWarning":false }' "https://api.enterprise.apigee.com/v1/mint/organizations/{organisation_id}/developers/emilia4.ipate@gmail.com/developer-rateplans"

4. I made some test calls and traced them. I can keep on making as many calls I want, I am never stopped after 2 calls or 4 calls (as I expected).

Can you please indicate what did I miss or set wrongly?

a) Your API proxy has to send header "callWeightTransaction" and it has to be a number in quotes. E.G. "0.5"

b) API proxy has to be monetization enabled.

c) What is your Transaction Success criteria?

#a) ok, I will try that. But I do not understand if there should be a connection between the value "0.5" in the header "callWeightTransaction" and the value "0.5" I put in the "Volume Bands: >0 up to 2". If there is no connection, then what should I put in "Volume > 0 up to 2" taking in consideration that I have a prepaid developer?

#b) the API proxy is enabled for monetization.

#c) I count all the GET API calls 🙂

3294-transactionrecordingpolicy.png

txProviderStatus == "GET" double quotes.

Also try to trace single call and click on [AX] block, find there mint.tx.status flow variable. It Should be "GET"

Not applicable

@Anil, we will analytics to get the usage data from Apigee.

Writing an Api proxy to divide by 32 seems a bit over the top taking in consideration that doing the division in excel is faster.

Would this piece of information be useful: 32 api calls is one billable transaction no matter the apikey. The 32 number is NOT customizable per user.