Rest API v1 reference

Get Metrics

Used to run metric gathering and return the results.

URL : /api/v1/metrics

Method : GET

URL Params

Optional:

dry_run=[boolean]

Success Response

Code : 200 OK

Content example

[
  {
    "resource": "flask-metric-866fcfc968-gdjxn",
    "value": "{\"value\": 5, \"available\": 0, \"min\": 0, \"max\": 5}"
  },
  {
    "resource": "flask-metric-866fcfc968-zqz9n",
    "value": "{\"value\": 0, \"available\": 5, \"min\": 0, \"max\": 5}"
  }
]

Sample Call:

curl -X GET "http://localhost:5000/api/v1/metrics?dry_run=false"

500 Error Response

Condition : If an error occurs in the Custom Pod Autoscaler while creating the evaluation.

Code : 500 INTERNAL SERVER ERROR

Content :

{
  "message": "exit status 1",
  "code": 500
}

400 Error Response

Condition : If an invalid (non boolean) 'dry_run' parameter has been provided.

Sample Call:

Code : 400 BAD REQUEST

Content :

{
  "message": "Invalid format for 'dry_run' query parameter; 'invalid' is not a valid boolean value",
  "code": 400
}

Create Evaluation

Used to evaluate metrics and then scale based on them, or optionally evaluate without scaling (dry run).

URL : /api/v1/evaluation

Method : POST

URL Params

Optional:

dry_run=[boolean]

Success Response

Code : 200 OK

Content example

{
  "targetReplicas": 2
}

500 Error Response

Condition : If an error occurs in the Custom Pod Autoscaler when gathering the metrics.

Sample Call:

Code : 500 INTERNAL SERVER ERROR

Content :

{
  "message": "exit status 1",
  "code": 500
}

400 Error Response

Condition : If an invalid (non boolean) 'dry_run' parameter has been provided.

Sample Call:

Code : 400 BAD REQUEST

Content :

{
  "message": "Invalid format for 'dry_run' query parameter; 'invalid' is not a valid boolean value",
  "code": 400
}

Sample Call:

curl -X POST "http://localhost:5000/api/v1/evaluation?dry_run=false"