Edit the quantity of a quota using PUT or PATCH

There are many reasons why you may choose to update a quota quantity. You can use the quota quantity to:

  • limit traffic to a quota

  • increase traffic to a quota

  • stop traffic to a quota

  • update quota quantities so that the remaining quantity is consistent with your system’s remaining quantity

You may update the quota quantity to any value greater than or equal to 0. If the new quantity is less than or equal to the quantity fielded, this quota will not receive any traffic.

In our system we have 2 parameters that helps to limit the traffic to a quota:

  • required_count

  • current_target

We use the first one (required_count) to limit the quota and we can change it via the request 1. This is the max value on completes that will reach the quota.

We use the second one (current_target) to monitor and limit the quota and the value can never be bigger than required_count. Here the rule:

  • current_target <= required_count

REST API versions:

  • PUT - Request 1

  • PATCH - Request 2

  • DEPRECATED - Request 3

Request 1 (PUT)


PUT $apihost/$basepath/surveys/7654/quotas/qb30

($apihost is the environment against which you are testing, and $basepath is the base path with the api version. All Buy API calls will require access-token parameter in the header) 

Body: 

1 2 3 4 5 6 7 8 9 10 { "buyer_quota_id": "qb30", "required_count": 100, "criteria": [{ "qualification_code": 214, "condition_codes": [ "112" ] }] }

Response 1 (PUT)


Response Code

200

Response Body

1 2 3 4 5 6 7 8 9 10 { "buyer_quota_id": "qb30", "required_count": 100, "criteria": [{ "qualification_code": 214, "condition_codes": [ "112" ] }] }

Request 2 (PATCH)


PATCH $apihost/$basepath/surveys/7654/quotas/qb30

($apihost is the environment against which you are testing, and $basepath is the base path with the api version. All Buy API calls will require access-token parameter in the header) 

Body: 

1 2 3 4 5 6 7 [ { "op": "replace", "path": "/current_target", "value": 171 } ]

Response 2 (PATCH)


Response Code

200

Response Body

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 { "quantities": { "hasValidQuotas": true, "isFlexible": true, "minimum": 35, "maximum": 35, "flexibility": 0, "number": 200, "percentage": 100, "achieved": 0, "remaining": 0, "currently_open": 0, "sup_currently_open": 0, "current_target": 171 }, "counter": { "Buyer_side_In_Progress": 0, "Buyer_Survey_Starts": 0, "Buyer_Valid_Clicks": 0 }, "buyer_quota_id": "qb30", "marker": "", "locked": false, "criteria": [{...}], "crtd_on": 1611074478715, "mod_on": 1611246548389, "_id": "60070bae00d59f3155555e44", "isActive": true, "type": 0, "quotaCategory": "autoNested", "quota_id": "d113426df-38de-3434-a69a-1734380f8d28", "suppliers": {...} }

Request 3 [DEPRICATED]


Body: 

1 2 3 4 5 [{ "op": "replace", "path": "/required_count", "value": 171 }]

Response 3 [DEPRICATED]


Response Code

200

Response Body

1 2 3 4 { "ps_buyer_quota_id": "qb30", "required_count": 171 }