From 6abc5a4cddb123f3285e1512588960b204d59c02 Mon Sep 17 00:00:00 2001 From: Mario de Frutos Date: Tue, 17 May 2016 16:35:41 +0200 Subject: [PATCH] Added section how the quota is spent in the document --- doc/internal/quota_management.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/doc/internal/quota_management.md b/doc/internal/quota_management.md index bed0ef0..f1f463d 100644 --- a/doc/internal/quota_management.md +++ b/doc/internal/quota_management.md @@ -12,13 +12,13 @@ All the user/organization quota information is stored in the user metadata in Re - `hgetall rails:users:username` - `hgetall rails:orgs:orgname` -This whole information is managed by the CartoDB Rails App too so we could make a number of useful operations in order to know how many quota do you have, how many quota have you spent this month, and so on: +This whole information is managed by the CartoDB Rails App too so we could make a numer of useful operations in order to know how much quota do you have, how much quota have you spent this month and so on. -- How can I know the current quota, number of uses, etc for a user? +###How can I know the current quota, number of uses, etc for a user?### - You could use the following endpoint to know it: `https://.cartodb.com/api/v1/users/?api_key=` - In the result of this endpoint you can see blocks with all the information. Eg: - ```json +You could use the following endpoint to know it: https://.cartodb.com/api/v1/users/?api_key= +In the result of this endpoint you can see blocks with all the information. Eg: +``` "geocoding": { "quota": 1000, "block_price": 1500, @@ -27,11 +27,9 @@ This whole information is managed by the CartoDB Rails App too so we could make } ``` - Note: the remaining credits left can be computed as: `remaining_quota = quota - monthly_use`. +### How can I set a new quota for a user### -- How can I set a new quota for a user: - - This operation could be done through the rails console: +This operation could be done through the rails console: - First you have to connect to the rails console: `bundle exec rails c` - Once in the console you have to get the target user/organization: - `u = User.find(username: '')` @@ -49,7 +47,7 @@ This whole information is managed by the CartoDB Rails App too so we could make - This way the user now has 2000 requests as their current quota - We can only change the hard limit flag for users, not for organizations -- What services could we edit?: +### What services we could change?### The following list numbers all the current services but this is a living list so it could keep growing in the future: @@ -57,3 +55,9 @@ This whole information is managed by the CartoDB Rails App too so we could make - Isolines: `here_isolines_quota`, `soft_here_isolines_limit` - Data observatory snapshot: `obs_snapshot_quota`, `soft_obs_snapshot_limit` - Data observatory general: `obs_general_quota`, `soft_obs_general_limit` + +### How is the quota spent?### + +Almost in all the services: geocoding, data observatory snapshot and general the number of spent credits is calculated per request made (either successful or empty request). + +In the case of the isolines service, the number of credits is calculated based on the number of isolines generated by the request. Ie. If your query generates 3 isolines for the request, you've spent 3 isolines credits.