Skip to content

GET /credits/

Get high-level information about credits.

GET /credits/ — fields

Comma-separated list of fields to include in response, in addition to 'type' and 'id' which are always present. Optional fields can be listed here also.

GET /credits/ — include

Include additional fields named in comma-separated values in response as nested JSON objects.

GET /api/v2/credits/

Get high-level information about credits.

Try it out

Playground

Authorization
Variables
Key
Value
Authorizations

Authorizations

api-key
Type
API Key (header: Authorization)
or
ripe-access
Type
API Key (cookie: crowd.token_key)
Parameters

Query Parameters

fields

Comma-separated list of fields to include in response, in addition to 'type' and 'id' which are always present. Optional fields can be listed here also.

Type
string
include

Include additional fields named in comma-separated values in response as nested JSON objects.

Type
string
Valid values
"income_items""expense_items"
Responses

Responses

application/json
object

This mixin looks for an included_serializers property on the serializer.
This property should hold a dict of the form:

{ : <SERIALIZER_CLASS>, }

This serializer is then used to replace the field (probably an id or a url) in the JSON output with the
actual object that the original field references.

It does so by using an instance of the <SERIALIZER_CLASS>.

If you want the field you're adding refers to another django model instance, you can make a include= query-
parameter on the field so a user can get the instance the field refers to nested in the measurement instance.
To do so put a reference to a serializer class or a serializer call for a ListSerializer in `include_serializers'.

You can also refer to a field of an included serializer by using a dotted notation,
i.e. <NESTED_SERIALIZER_NAME>.<FIELD_NAME>. The source= argument in the nested serializer call should refer
to the name of the field in the nested serializer.

example from measurements.MeasurementSerializer:

included_serializers = {
'participation_requests': ParticipationRequestSerializer(
source="sources",
many=True,
required=False,
read_only=True
),
}


This mixin was acquired from djangorestframework-jsonapi
https://github.com/django-json-api/django-rest-framework-json-api/blob/develop/rest_framework_json_api/serializers.py

extended to be able to holds nested serializers and dotted field notation.

The json api (http://http://jsonapi.org/) has a included field that holds an array of JSON objects in the root.
So it doesn't do a replacement of the reference field.

Current number of available credits

Do we perform a credit check before creating the measurement

Maximum number of credits that can be spend in a day

Total estimated daily income from all income items

Total estimated daily expenditure from all expense items

Estimated daily income minus estimated daily expenditure

Time that the estimates were produced

Format"date-time"

Estimated elapsed time from calculation_time until total credit balance will drop to zero

Number of results from user-defined measurements in the past 24 hours

Number of credits spent in the past 24 hours

Last time the account was debited

Format"date-time"

Last time the account was credited

Format"date-time"

URL of the income-items list (include directly using ?include=income_items)

Format"url"

URL of the expense-items list (include directly using ?include=expense_items)

Format"url"

URL of the transactions list

Format"url"
Samples