post https://api.chartmogul.com/v1/plan_groups
Creates a plan_group
object in ChartMogul.
Examples
curl -X POST "https://api.chartmogul.com/v1/plan_groups" \
-u YOUR_API_KEY: \
-H "Content-Type: application/json" \
-d '{
"name": "Growth Plans",
"plans": ["pl_6add9607-23ce-11eb-8b6f-cfcb12b8f91f", "pl_b4eaffff-23ce-11eb-8b6f-03cebf8dcd12"]
}'
plan_one = ChartMogul::Plan.retrieve('pl_6add9607-23ce-11eb-8b6f-cfcb12b8f91f')
plan_two = ChartMogul::Plan.retrieve('pl_b4eaffff-23ce-11eb-8b6f-03cebf8dcd12')
ChartMogul::PlanGroup.create!(
name: 'Growth Plans',
plans: [plan_one, plan_two]
)
ChartMogul.PlanGroup.create(config, {
"name": "Growth Plans",
"plans": ["pl_6add9607-23ce-11eb-8b6f-cfcb12b8f91f", "pl_b4eaffff-23ce-11eb-8b6f-03cebf8dcd12"],
});
<?php
ChartMogul\PlanGroup::create([
"name" => "Growth Plans",
"plans" => ["pl_6add9607-23ce-11eb-8b6f-cfcb12b8f91f", "pl_b4eaffff-23ce-11eb-8b6f-03cebf8dcd12"],
]);
?>
api.CreatePlanGroup(&cm.PlanGroup{
Name: "Growth Plans",
Plans: []*string{"pl_6add9607-23ce-11eb-8b6f-cfcb12b8f91f", "pl_b4eaffff-23ce-11eb-8b6f-03cebf8dcd12"}
})
chartmogul.PlanGroup.create(
config,
data={
"name": "Growth Plans",
"plans": ["pl_6add9607-23ce-11eb-8b6f-cfcb12b8f91f", "pl_b4eaffff-23ce-11eb-8b6f-03cebf8dcd12"],
})
Result Format
{
"name": "Growth Plans",
"uuid": "plg_21304231-dfb4-41c0-a84c-de4783c5534c",
"plans_count": 2
}
<ChartMogul::PlanGroup:0x00007f9e1a560d78
@name="Growth Plans",
@plans_count=2,
@uuid="plg_21304231-dfb4-41c0-a84c-de4783c5534c">
{
"name": "Growth Plans",
"uuid": "plg_21304231-dfb4-41c0-a84c-de4783c5534c",
"plans_count": 2
}
<?php
ChartMogul\Plan::__set_state(array(
"uuid" => "plg_21304231-dfb4-41c0-a84c-de4783c5534c",
"name" => "Growth Plans",
"plans_count" => 2,
));
?>
(*chartmogul.PlanGroup)(0xc04203e5a0)({
UUID: (string) (len=39) "plg_21304231-dfb4-41c0-a84c-de4783c5534c",
Name: (string) (len=11) "Growth Plans",
PlansCount: (uint32) 2,
})
<PlanGroup{
plans_count=2,
name='Growth Plans',
uuid='plg_21304231-dfb4-41c0-a84c-de4783c5534c'}>
In the response, the JSON
object contains the following data:
uuid
- The UUID of theplan group
object generated by ChartMogul.name
- Name of this plan group, as specified by you.plans_count
- The number of plans in the plan group.