Buckets (StatsD)

Attributes

id (read-only) Unique ID for the bucket in our system.
create_time (read-only) The time the bucket was created.
name (read-only) The name for this bucket.
type (read-only) The type of bucket (either time, counter, or gauge).
last_updated (read-only) The time the bucket was last updated.
url (read-only) URL information about the requested item.

Available APIs

/api/buckets/{bucket_id}/

View or edit a bucket.

GET

Get info about a specific bucket, given by the bucket_id in the URL. It takes no additional parameters.

curl --user {EMAIL}:{API_KEY} https://wwws.appfirst.com/api/buckets/1/
{
    "id": 181, 
    "name": "sys.app.memcached.bytes_written", 
    "type": "counter", 
    "create_time": 1342010590, 
    "last_updated": 1342010590, 
    "url": "https://wwws.appfirst.com/api/v5/buckets/181/"
}

DELETE

Deletes the specific bucket given by the bucket_id in the URL. Returns 200 if successfully deleted.

/api/buckets/

Lists all available bucket data items. See above for the attributes each item has.

GET

Returns the list of buckets for the tenant.

Arguments

  • limit (optional, default:2500, max:2500) – Sets the page size to a limit set by the user.
  • page (optional, default:0) – Retrieve the specific page of data of size limit.

Argument Examples

  • limit=10 – will get the first page of the first 10 items.
  • limit=25&page=3 – will get the 4th page of size 25 items.
curl --user {EMAIL}:{API_KEY} https://wwws.appfirst.com/api/buckets/
{
    "pagination": {
        "count": 1935, 
        "next": null, 
        "previous": null
    }, 
    "data": [
        {
            "id": 181, 
            "name": "sys.app.memcached.bytes_written", 
            "type": "counter", 
            "create_time": 1342010590, 
            "last_updated": 1342010590, 
            "url": "https://wwws.appfirst.com/api/v5/buckets/181/"
        }, 
        {
            "id": 191, 
            "name": "sys.app.resque.job_processed", 
            "type": "gauge", 
            "create_time": 1342681222, 
            "last_updated": 1342681222, 
            "url": "https://wwws.appfirst.com/api/v5/buckets/191/"
        }, 
    ]
}

POST

Process a new StatsD (bucket) message.

Return success if the statsd message has been successfully processed, otherwise it will return HttpResponseBadRequest with error message included. Note that the API requires that each of statsd (bucket) message has a valid format of BUCKET_NAME:BUCKET_VALUE. The valid length of BUCKET_NAME is between 1 and 256 characters. However, the API doesn’t check whether the BUCKET_VALUE is in a valid statsd format. As long as it’s not empty, the API won’t return any errors. You can use any bucket name as you want, while the bucket type can’t be changed after the first message with that bucket name has been processed. You might see inconsistent results if you stream to the same bucket with different bucket types.

For more information refer here.

Arguments

  • buckets (required) – An encoded JSON string which can be decoded as a list of statsd (bucket) object keyed by value, as {‘value’: STATSD_BUCKET_NAME:STATSD_VALUE}.
curl --user {EMAIL}:{API_KEY} -d buckets='[{"value": "erica.gaugetest:18|g|1361385031|eric test1|santosh test2|ym test3"}]' https://wwws.appfirst.com/api/buckets/
{
    "result": "Success",
}

DELETE

Deletes a bucket with the given parameter name.

curl --user {EMAIL}:{API_KEY} -X DELETE https://wwws.appfirst.com/api/buckets/?name=Sample_Bucket1