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
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
This mixin looks for an included_serializers property on the serializer.
This property should hold a dict of the form:
{
This serializer is then used to replace 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.
Collapse
current_balance
integer
Required
Current number of available credits
credit_checked
boolean
Required
Do we perform a credit check before creating the measurement
max_daily_credits
integer
Required
Maximum number of credits that can be spend in a day
estimated_daily_income
integer
Required
Total estimated daily income from all income items
estimated_daily_expenditure
integer
Required
Total estimated daily expenditure from all expense items
estimated_daily_balance
integer
Required
Estimated daily income minus estimated daily expenditure
calculation_time
string
Required
Time that the estimates were produced
Format
"date-time"estimated_runout_seconds
integer
Required
Estimated elapsed time from calculation_time until total credit balance will drop to zero
past_day_measurement_results
integer
Required
Number of results from user-defined measurements in the past 24 hours
past_day_credits_spent
integer
Required
Number of credits spent in the past 24 hours
last_date_debited
string
Required
Last time the account was debited
Format
"date-time"last_date_credited
string
Required
Last time the account was credited
Format
"date-time"income_items
string
Required
URL of the income-items list (include directly using ?include=income_items)
Format
"url"expense_items
string
Required
URL of the expense-items list (include directly using ?include=expense_items)
Format
"url"transactions
string
Required
URL of the transactions list
Format
"url"