Skip to content

Customer Credits

Operations Summary

Method Endpoint Description
Core CRUD
GET /api/customer-credits/ List Customer Credits
GET /api/customer-credits/{uuid}/ Retrieve
POST /api/customer-credits/ Create
PUT /api/customer-credits/{uuid}/ Update
PATCH /api/customer-credits/{uuid}/ Partial Update
DELETE /api/customer-credits/{uuid}/ Delete
Other Actions
GET /api/customer-credits/{uuid}/consumptions/ Get credit consumption history grouped by month
POST /api/customer-credits/{uuid}/apply_compensations/ Apply compensations
POST /api/customer-credits/{uuid}/clear_compensations/ Clear compensations

Core CRUD

List Customer Credits

1
2
3
4
http \
  GET \
  https://api.example.com/api/customer-credits/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.api.customer_credits import customer_credits_list # (1)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = customer_credits_list.sync(client=client)

for item in response:
    print(item)
  1. API Source: customer_credits_list
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import { customerCreditsList } from 'waldur-js-client';

try {
  const response = await customerCreditsList({
  auth: "Token YOUR_API_TOKEN"
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Description
customer_name string
customer_slug string
customer_uuid string (uuid)
o array Ordering

page integer A page number within the paginated result set.
page_size integer Number of results to return per page.

200 -

The response body is an array of objects, where each object has the following structure:

Field Type
uuid string (uuid)
url string (uri)
value string (decimal)
customer string (uri)
customer_name string
customer_uuid string (uuid)
customer_slug string
offerings array of objects
offerings.uuid string (uuid)
offerings.url string (uri)
offerings.type string
offerings.name string
end_date string (date)
expected_consumption string (decimal)
minimal_consumption number (double)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean
allocated_to_projects number (double)
consumption_last_month number (double)

Retrieve

1
2
3
4
http \
  GET \
  https://api.example.com/api/customer-credits/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.api.customer_credits import customer_credits_retrieve # (1)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = customer_credits_retrieve.sync(
    uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    client=client
)

print(response)
  1. API Source: customer_credits_retrieve
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { customerCreditsRetrieve } from 'waldur-js-client';

try {
  const response = await customerCreditsRetrieve({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
uuid string (uuid)

200 -

Field Type
uuid string (uuid)
url string (uri)
value string (decimal)
customer string (uri)
customer_name string
customer_uuid string (uuid)
customer_slug string
offerings array of objects
offerings.uuid string (uuid)
offerings.url string (uri)
offerings.type string
offerings.name string
end_date string (date)
expected_consumption string (decimal)
minimal_consumption number (double)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean
allocated_to_projects number (double)
consumption_last_month number (double)

Create

1
2
3
4
5
http \
  POST \
  https://api.example.com/api/customer-credits/ \
  Authorization:"Token YOUR_API_TOKEN" \
  customer="https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.models.create_customer_credit_request import CreateCustomerCreditRequest # (1)
from waldur_api_client.api.customer_credits import customer_credits_create # (2)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)

body_data = CreateCustomerCreditRequest(
    customer="https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
)
response = customer_credits_create.sync(
    client=client,
    body=body_data
)

print(response)
  1. Model Source: CreateCustomerCreditRequest
  2. API Source: customer_credits_create
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { customerCreditsCreate } from 'waldur-js-client';

try {
  const response = await customerCreditsCreate({
  auth: "Token YOUR_API_TOKEN",
  body: {
    "customer": "https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Field Type Required
value string (decimal)
customer string (uri)
offerings array of string (uri)s
end_date string (date)
expected_consumption string (decimal)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean

201 -

Field Type
uuid string (uuid)
url string (uri)
value string (decimal)
customer string (uri)
customer_name string
customer_uuid string (uuid)
customer_slug string
offerings array of string (uri)s
end_date string (date)
expected_consumption string (decimal)
minimal_consumption number (double)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean
allocated_to_projects number (double)
consumption_last_month number (double)

Update

1
2
3
4
5
http \
  PUT \
  https://api.example.com/api/customer-credits/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
  Authorization:"Token YOUR_API_TOKEN" \
  customer="https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.models.create_customer_credit_request import CreateCustomerCreditRequest # (1)
from waldur_api_client.api.customer_credits import customer_credits_update # (2)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)

body_data = CreateCustomerCreditRequest(
    customer="https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
)
response = customer_credits_update.sync(
    uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    client=client,
    body=body_data
)

print(response)
  1. Model Source: CreateCustomerCreditRequest
  2. API Source: customer_credits_update
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import { customerCreditsUpdate } from 'waldur-js-client';

try {
  const response = await customerCreditsUpdate({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  },
  body: {
    "customer": "https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
uuid string (uuid)
Field Type Required
value string (decimal)
customer string (uri)
offerings array of string (uri)s
end_date string (date)
expected_consumption string (decimal)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean

200 -

Field Type
uuid string (uuid)
url string (uri)
value string (decimal)
customer string (uri)
customer_name string
customer_uuid string (uuid)
customer_slug string
offerings array of string (uri)s
end_date string (date)
expected_consumption string (decimal)
minimal_consumption number (double)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean
allocated_to_projects number (double)
consumption_last_month number (double)

Partial Update

1
2
3
4
http \
  PATCH \
  https://api.example.com/api/customer-credits/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.models.patched_create_customer_credit_request import PatchedCreateCustomerCreditRequest # (1)
from waldur_api_client.api.customer_credits import customer_credits_partial_update # (2)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)

body_data = PatchedCreateCustomerCreditRequest()
response = customer_credits_partial_update.sync(
    uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    client=client,
    body=body_data
)

print(response)
  1. Model Source: PatchedCreateCustomerCreditRequest
  2. API Source: customer_credits_partial_update
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { customerCreditsPartialUpdate } from 'waldur-js-client';

try {
  const response = await customerCreditsPartialUpdate({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
uuid string (uuid)
Field Type Required
value string (decimal)
customer string (uri)
offerings array of string (uri)s
end_date string (date)
expected_consumption string (decimal)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean

200 -

Field Type
uuid string (uuid)
url string (uri)
value string (decimal)
customer string (uri)
customer_name string
customer_uuid string (uuid)
customer_slug string
offerings array of string (uri)s
end_date string (date)
expected_consumption string (decimal)
minimal_consumption number (double)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean
allocated_to_projects number (double)
consumption_last_month number (double)

Delete

1
2
3
4
http \
  DELETE \
  https://api.example.com/api/customer-credits/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.api.customer_credits import customer_credits_destroy # (1)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = customer_credits_destroy.sync(
    uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    client=client
)

print(response)
  1. API Source: customer_credits_destroy
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { customerCreditsDestroy } from 'waldur-js-client';

try {
  const response = await customerCreditsDestroy({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
uuid string (uuid)

204 - No response body


Other Actions

Get credit consumption history grouped by month

Get credit consumption history grouped by month.

1
2
3
4
http \
  GET \
  https://api.example.com/api/customer-credits/a1b2c3d4-e5f6-7890-abcd-ef1234567890/consumptions/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.api.customer_credits import customer_credits_consumptions_list # (1)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = customer_credits_consumptions_list.sync(
    uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    client=client
)

for item in response:
    print(item)
  1. API Source: customer_credits_consumptions_list
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { customerCreditsConsumptionsList } from 'waldur-js-client';

try {
  const response = await customerCreditsConsumptionsList({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
uuid string (uuid)
Name Type Description
customer_name string
customer_slug string
customer_uuid string (uuid)
o array Ordering

page integer A page number within the paginated result set.
page_size integer Number of results to return per page.

200 -

The response body is an array of objects, where each object has the following structure:

Field Type
date string (date)
price string (decimal)

Apply compensations

1
2
3
4
5
http \
  POST \
  https://api.example.com/api/customer-credits/a1b2c3d4-e5f6-7890-abcd-ef1234567890/apply_compensations/ \
  Authorization:"Token YOUR_API_TOKEN" \
  customer="https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.models.customer_credit_request import CustomerCreditRequest # (1)
from waldur_api_client.api.customer_credits import customer_credits_apply_compensations # (2)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)

body_data = CustomerCreditRequest(
    customer="https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
)
response = customer_credits_apply_compensations.sync(
    uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    client=client,
    body=body_data
)

print(response)
  1. Model Source: CustomerCreditRequest
  2. API Source: customer_credits_apply_compensations
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import { customerCreditsApplyCompensations } from 'waldur-js-client';

try {
  const response = await customerCreditsApplyCompensations({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  },
  body: {
    "customer": "https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
uuid string (uuid)
Field Type Required
value string (decimal)
customer string (uri)
end_date string (date)
expected_consumption string (decimal)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean

200 -

Field Type
uuid string (uuid)
url string (uri)
value string (decimal)
customer string (uri)
customer_name string
customer_uuid string (uuid)
customer_slug string
offerings array of objects
offerings.uuid string (uuid)
offerings.url string (uri)
offerings.type string
offerings.name string
end_date string (date)
expected_consumption string (decimal)
minimal_consumption number (double)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean
allocated_to_projects number (double)
consumption_last_month number (double)

Clear compensations

1
2
3
4
5
http \
  POST \
  https://api.example.com/api/customer-credits/a1b2c3d4-e5f6-7890-abcd-ef1234567890/clear_compensations/ \
  Authorization:"Token YOUR_API_TOKEN" \
  customer="https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.models.customer_credit_request import CustomerCreditRequest # (1)
from waldur_api_client.api.customer_credits import customer_credits_clear_compensations # (2)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)

body_data = CustomerCreditRequest(
    customer="https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
)
response = customer_credits_clear_compensations.sync(
    uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    client=client,
    body=body_data
)

print(response)
  1. Model Source: CustomerCreditRequest
  2. API Source: customer_credits_clear_compensations
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import { customerCreditsClearCompensations } from 'waldur-js-client';

try {
  const response = await customerCreditsClearCompensations({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  },
  body: {
    "customer": "https://api.example.com/api/customer/a1b2c3d4-e5f6-7890-abcd-ef1234567890/"
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
uuid string (uuid)
Field Type Required
value string (decimal)
customer string (uri)
end_date string (date)
expected_consumption string (decimal)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean

200 -

Field Type
uuid string (uuid)
url string (uri)
value string (decimal)
customer string (uri)
customer_name string
customer_uuid string (uuid)
customer_slug string
offerings array of objects
offerings.uuid string (uuid)
offerings.url string (uri)
offerings.type string
offerings.name string
end_date string (date)
expected_consumption string (decimal)
minimal_consumption number (double)
minimal_consumption_logic string
grace_coefficient string (decimal)
apply_as_minimal_consumption boolean
allocated_to_projects number (double)
consumption_last_month number (double)