Quotas

Summary

The Quota REST API provides access to the API Manager's quota management.

Description

With the Quota API, it is possible to change default system and application usage limits.

Resources

Resource Since Version Description
POST /api/portal/v1.3/quotas Creates a new quota
GET /api/portal/v1.3/quotas Returns all quotas
PUT /api/portal/v1.3/quotas/{id} Updates a quota
DELETE /api/portal/v1.3/quotas/{id} Deletes a quota
GET /api/portal/v1.3/quotas/{id} Returns the quota with the given ID

POST /api/portal/v1.3/quotas

Summary

Creates a new quota

Description

Creates a new quota. Only API Administrators may create quotas.

Parameters

Parameter Description Data Type Location Required Multiple
- The Quota is a set of restrictions that apply to applications in the Portal. QuotaDTO body Required

Status Codes

HTTP Status Code Reason
201 Created
500 Internal Server Error

Returns Class

Quota

Example

POST https://localhost:8075/api/portal/v1.3/quotas

Request

{
  "id" : "a1c70859-702b-4f3a-a1ad-a61067fdc4c7",
  "type" : "APPLICATION",
  "name" : "MyApplication Quota",
  "description" : "A set of restrictions to MyApplication",
  "restrictions" : [ {
    "api" : "60d1c7da-9e2e-4f57-948a-eeb1da71beca",
    "method" : "0c5f8a4a-0e74-4e66-ad7b-e21962940e02",
    "type" : "throttle",
    "config" : {
      "messages" : "10",
      "per" : "1",
      "period" : "seconds"
    }
  } ],
  "system" : false
}

Response
HTTP 1.1 200 OK
{
  "id" : "a1c70859-702b-4f3a-a1ad-a61067fdc4c7",
  "type" : "APPLICATION",
  "name" : "MyApplication Quota",
  "description" : "A set of restrictions to MyApplication",
  "restrictions" : [ {
    "api" : "60d1c7da-9e2e-4f57-948a-eeb1da71beca",
    "method" : "0c5f8a4a-0e74-4e66-ad7b-e21962940e02",
    "type" : "throttle",
    "config" : {
      "messages" : "10",
      "per" : "1",
      "period" : "seconds"
    }
  } ],
  "system" : false
}


GET /api/portal/v1.3/quotas

Summary

Returns all quotas

Description

This method may be called by any member of the Portal, however only the API Administrator may retrieve the system quota.

Parameters

none

Status Codes

HTTP Status Code Reason
204 No Content
404 Not Found
500 Internal Server Error

Returns Class

Quota


PUT /api/portal/v1.3/quotas/{id}

Summary

Updates a quota

Description

Updates an existing quota. Only API Administrators may update quotas.

Parameters

Parameter Description Data Type Location Required Multiple
- The Quota is a set of restrictions that apply to applications in the Portal. QuotaDTO body Required
quota The quota to update. Quota query Required

Status Codes

HTTP Status Code Reason
200 OK
404 Not Found
500 Internal Server Error

Returns Class

Quota

Example

PUT https://localhost:8075/api/portal/v1.3/quotas/{id}

Request

{
  "id" : "a1c70859-702b-4f3a-a1ad-a61067fdc4c7",
  "type" : "APPLICATION",
  "name" : "MyApplication Quota",
  "description" : "A set of restrictions to MyApplication",
  "restrictions" : [ {
    "api" : "60d1c7da-9e2e-4f57-948a-eeb1da71beca",
    "method" : "0c5f8a4a-0e74-4e66-ad7b-e21962940e02",
    "type" : "throttle",
    "config" : {
      "messages" : "10",
      "per" : "1",
      "period" : "seconds"
    }
  } ],
  "system" : false
}

Response
HTTP 1.1 200 OK
{
  "id" : "a1c70859-702b-4f3a-a1ad-a61067fdc4c7",
  "type" : "APPLICATION",
  "name" : "MyApplication Quota",
  "description" : "A set of restrictions to MyApplication",
  "restrictions" : [ {
    "api" : "60d1c7da-9e2e-4f57-948a-eeb1da71beca",
    "method" : "0c5f8a4a-0e74-4e66-ad7b-e21962940e02",
    "type" : "throttle",
    "config" : {
      "messages" : "10",
      "per" : "1",
      "period" : "seconds"
    }
  } ],
  "system" : false
}


DELETE /api/portal/v1.3/quotas/{id}

Summary

Deletes a quota

Description

Deletes a quota. Only API Administrators may update quotas. Default system and application quotas may not be deleted.

Parameters

Parameter Description Data Type Location Required Multiple
id The quota ID to delete. String path Required

Status Codes

HTTP Status Code Reason
204 No Content
404 Not Found
500 Internal Server Error

GET /api/portal/v1.3/quotas/{id}

Summary

Returns the quota with the given ID

Description

Returns a quota. This method may be called by any member of the Portal, however, only API Administrators may retrieve the system quota.

Parameters

Parameter Description Data Type Location Required Multiple
id The quota ID to retrieve. String path Required

Status Codes

HTTP Status Code Reason
204 No Content
404 Not Found
500 Internal Server Error

Returns Class

Quota

Example

GET http://localhost:8075/api/portal/quotas/a1c70859-702b-4f3a-a1ad-a61067fdc4c7
HTTP 1.1 200 OK

Returns the quota with the given ID.

Each quota is returned as a JSON string in the following format:

   
    {
        "id": "a1c70859-702b-4f3a-a1ad-a61067fdc4c7",
        "type": "API",
        "name": "System",
        "description": "Default maximum restrictions to all API",
        "restrictions": [
            {
                "api": "60d1c7da-9e2e-4f57-948a-eeb1da71beca",
                "method": "0c5f8a4a-0e74-4e66-ad7b-e21962940e02",
                "verb": "GET",
                "type": "throttlemb",
                "config": {
                    "mb": "100",
                    "per": "1",
                    "period": "seconds"
                }
            },
            {
                "api": "60d1c7da-9e2e-4f57-948a-eeb1da71beca",
                "method": "0c5f8a4a-0e74-4e66-ad7b-e21962940e02",
                "verb": "GET",
                "type": "throttle",
                "config": {
                    "messages": "10000"
                    "per": "1",
                    "period": "seconds",
                }
            }
        ]
    }