Operations Summary
Core CRUD
Retrieve
Create
| http \
POST \
https://api.example.com/api/promotions-campaigns/ \
Authorization:"Token YOUR_API_TOKEN" \
name="my-awesome-promotions-campaign" \
start_date="2023-10-01" \
end_date="2023-10-01" \
discount_type="discount" \
discount=123 \
service_provider="https://api.example.com/api/service-provider/a1b2c3d4-e5f6-7890-abcd-ef1234567890/" \
offerings:='[]'
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 | from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.models.campaign_request import CampaignRequest # (1)
from waldur_api_client.api.promotions_campaigns import promotions_campaigns_create # (2)
client = AuthenticatedClient(
base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
body_data = CampaignRequest(
name="my-awesome-promotions-campaign",
start_date="2023-10-01",
end_date="2023-10-01",
discount_type="discount",
discount=123,
service_provider="https://api.example.com/api/service-provider/a1b2c3d4-e5f6-7890-abcd-ef1234567890/",
offerings=[]
)
response = promotions_campaigns_create.sync(
client=client,
body=body_data
)
print(response)
|
- Model Source:
CampaignRequest
- API Source:
promotions_campaigns_create
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 | import { promotionsCampaignsCreate } from 'waldur-js-client';
try {
const response = await promotionsCampaignsCreate({
auth: "Token YOUR_API_TOKEN",
body: {
"name": "my-awesome-promotions-campaign",
"start_date": "2023-10-01",
"end_date": "2023-10-01",
"discount_type": "discount",
"discount": 123,
"service_provider": "https://api.example.com/api/service-provider/a1b2c3d4-e5f6-7890-abcd-ef1234567890/",
"offerings": []
}
});
console.log('Success:', response);
} catch (error) {
console.error('Error:', error);
}
|
| Field |
Type |
Required |
Description |
name |
string |
✓ |
|
start_date |
string (date) |
✓ |
Starting from this date, the campaign is active. |
end_date |
string (date) |
✓ |
The last day the campaign is active. |
coupon |
string |
|
If coupon is empty, campaign is available to all users. |
discount_type |
string |
✓ |
Enum: discount, special_price |
discount |
integer |
✓ |
|
stock |
integer |
|
|
description |
string |
|
|
months |
integer |
|
How many months in a row should the related service (when activated) get special deal (0 for indefinitely until active) |
auto_apply |
boolean |
|
|
service_provider |
string (uri) |
✓ |
|
offerings |
array of string (uuid)s |
✓ |
Constraints: write-only |
required_offerings |
array of string (uuid)s |
|
|
201 -
| Field |
Type |
Description |
uuid |
string (uuid) |
|
name |
string |
|
url |
string (uri) |
|
start_date |
string (date) |
Starting from this date, the campaign is active. |
end_date |
string (date) |
The last day the campaign is active. |
coupon |
string |
If coupon is empty, campaign is available to all users. |
discount_type |
string |
Enum: discount, special_price |
discount |
integer |
|
stock |
integer |
|
description |
string |
|
months |
integer |
How many months in a row should the related service (when activated) get special deal (0 for indefinitely until active) |
auto_apply |
boolean |
|
state |
string |
|
service_provider |
string (uri) |
|
offerings |
array of objects |
|
offerings.uuid |
string (uuid) |
|
offerings.name |
string |
|
required_offerings |
array of string (uuid)s |
|
Update
| http \
PUT \
https://api.example.com/api/promotions-campaigns/a1b2c3d4-e5f6-7890-abcd-ef1234567890/ \
Authorization:"Token YOUR_API_TOKEN" \
name="my-awesome-promotions-campaign" \
start_date="2023-10-01" \
end_date="2023-10-01" \
discount_type="discount" \
discount=123 \
service_provider="https://api.example.com/api/service-provider/a1b2c3d4-e5f6-7890-abcd-ef1234567890/" \
offerings:='[]'
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 | from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.models.campaign_request import CampaignRequest # (1)
from waldur_api_client.api.promotions_campaigns import promotions_campaigns_update # (2)
client = AuthenticatedClient(
base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
body_data = CampaignRequest(
name="my-awesome-promotions-campaign",
start_date="2023-10-01",
end_date="2023-10-01",
discount_type="discount",
discount=123,
service_provider="https://api.example.com/api/service-provider/a1b2c3d4-e5f6-7890-abcd-ef1234567890/",
offerings=[]
)
response = promotions_campaigns_update.sync(
uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
client=client,
body=body_data
)
print(response)
|
- Model Source:
CampaignRequest
- API Source:
promotions_campaigns_update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 | import { promotionsCampaignsUpdate } from 'waldur-js-client';
try {
const response = await promotionsCampaignsUpdate({
auth: "Token YOUR_API_TOKEN",
path: {
"uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
body: {
"name": "my-awesome-promotions-campaign",
"start_date": "2023-10-01",
"end_date": "2023-10-01",
"discount_type": "discount",
"discount": 123,
"service_provider": "https://api.example.com/api/service-provider/a1b2c3d4-e5f6-7890-abcd-ef1234567890/",
"offerings": []
}
});
console.log('Success:', response);
} catch (error) {
console.error('Error:', error);
}
|
| Name |
Type |
Required |
uuid |
string (uuid) |
✓ |
| Field |
Type |
Required |
Description |
name |
string |
✓ |
|
start_date |
string (date) |
✓ |
Starting from this date, the campaign is active. |
end_date |
string (date) |
✓ |
The last day the campaign is active. |
coupon |
string |
|
If coupon is empty, campaign is available to all users. |
discount_type |
string |
✓ |
Enum: discount, special_price |
discount |
integer |
✓ |
|
stock |
integer |
|
|
description |
string |
|
|
months |
integer |
|
How many months in a row should the related service (when activated) get special deal (0 for indefinitely until active) |
auto_apply |
boolean |
|
|
service_provider |
string (uri) |
✓ |
|
offerings |
array of string (uuid)s |
✓ |
Constraints: write-only |
required_offerings |
array of string (uuid)s |
|
|
200 -
| Field |
Type |
Description |
uuid |
string (uuid) |
|
name |
string |
|
url |
string (uri) |
|
start_date |
string (date) |
Starting from this date, the campaign is active. |
end_date |
string (date) |
The last day the campaign is active. |
coupon |
string |
If coupon is empty, campaign is available to all users. |
discount_type |
string |
Enum: discount, special_price |
discount |
integer |
|
stock |
integer |
|
description |
string |
|
months |
integer |
How many months in a row should the related service (when activated) get special deal (0 for indefinitely until active) |
auto_apply |
boolean |
|
state |
string |
|
service_provider |
string (uri) |
|
offerings |
array of objects |
|
offerings.uuid |
string (uuid) |
|
offerings.name |
string |
|
required_offerings |
array of string (uuid)s |
|
Delete
Other Actions
Return a list of orders for which the campaign is applied
Return a list of orders for which the campaign is applied.
| http \
GET \
https://api.example.com/api/promotions-campaigns/a1b2c3d4-e5f6-7890-abcd-ef1234567890/orders/ \
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.promotions_campaigns import promotions_campaigns_orders_list # (1)
client = AuthenticatedClient(
base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = promotions_campaigns_orders_list.sync(
uuid="a1b2c3d4-e5f6-7890-abcd-ef1234567890",
client=client
)
for item in response:
print(item)
|
- API Source:
promotions_campaigns_orders_list
1
2
3
4
5
6
7
8
9
10
11
12
13 | import { promotionsCampaignsOrdersList } from 'waldur-js-client';
try {
const response = await promotionsCampaignsOrdersList({
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 |
field |
array |
|
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 |
Description |
offering |
string (uri) |
|
offering_name |
string |
|
offering_uuid |
string (uuid) |
|
offering_description |
string |
|
offering_image |
string (uri) |
|
offering_thumbnail |
string (uri) |
|
offering_type |
string |
|
offering_shared |
boolean |
Accessible to all customers. |
offering_billable |
boolean |
Purchase and usage is invoiced. |
offering_plugin_options |
any |
Public data used by specific plugin, such as storage mode for OpenStack. |
provider_name |
string |
|
provider_uuid |
string (uuid) |
|
provider_slug |
string |
|
category_title |
string |
|
category_uuid |
string (uuid) |
|
category_icon |
string (uri) |
|
plan |
string (uri) |
|
plan_unit |
any |
|
plan_name |
string |
|
plan_uuid |
string (uuid) |
|
plan_description |
string |
|
attributes |
any |
|
limits |
object (free-form) |
|
uuid |
string (uuid) |
|
created |
string (date-time) |
|
modified |
string (date-time) |
|
resource_uuid |
string (uuid) |
|
resource_type |
string |
|
resource_name |
string |
|
cost |
string (decimal) |
|
state |
any |
|
output |
string |
|
marketplace_resource_uuid |
string (uuid) |
|
error_message |
string |
|
error_traceback |
string |
|
callback_url |
string (uri) |
|
completed_at |
string (date-time) |
|
request_comment |
string |
|
attachment |
string (uri) |
|
type |
any |
|
start_date |
string (date) |
Enables delayed processing of resource provisioning order. |
url |
string (uri) |
|
consumer_reviewed_by |
string |
Required. 128 characters or fewer. Lowercase letters, numbers and @/./+/-/_ characters |
consumer_reviewed_by_full_name |
string |
|
consumer_reviewed_by_username |
string |
Required. 128 characters or fewer. Lowercase letters, numbers and @/./+/-/_ characters |
consumer_reviewed_at |
string (date-time) |
|
provider_reviewed_by |
string |
Required. 128 characters or fewer. Lowercase letters, numbers and @/./+/-/_ characters |
provider_reviewed_by_full_name |
string |
|
provider_reviewed_by_username |
string |
Required. 128 characters or fewer. Lowercase letters, numbers and @/./+/-/_ characters |
provider_reviewed_at |
string (date-time) |
|
created_by_username |
string |
Required. 128 characters or fewer. Lowercase letters, numbers and @/./+/-/_ characters |
created_by_full_name |
string |
|
created_by_civil_number |
string |
|
customer_name |
string |
|
customer_uuid |
string (uuid) |
|
customer_slug |
string |
|
project_name |
string |
|
project_uuid |
string (uuid) |
|
project_description |
string |
|
project_slug |
string |
|
old_plan_name |
string |
|
new_plan_name |
string |
|
old_plan_uuid |
string (uuid) |
|
new_plan_uuid |
string (uuid) |
|
old_cost_estimate |
string (decimal) |
|
new_cost_estimate |
string (decimal) |
|
can_terminate |
boolean |
|
fixed_price |
number (double) |
|
activation_price |
number (double) |
|
termination_comment |
string |
|
backend_id |
string |
|
issue |
any |
|
Return a list of resources for which the campaign is applied
Return a list of resources for which the campaign is applied.
Activate campaign
Activate campaign.
Terminate campaign
Terminate campaign.