Plans
Base URL
All following endpoints operates over the URL of your store:
https://your-store.com
example:
https://alephdigital.publica.la
Endpoints |
---|
Create |
Retrieve |
Update |
Headers
{
'Content-Type': 'application/json',
'Accept: 'application/json',
'X-User-Token': api_token,
}
info
Make sure you generated the api_token on your store. More info HERE
Create
POST /integration-api/v1/dashboard/plans
Body parameters
Parameter | Type | Description |
---|---|---|
type | string | Valid values: recurring , prepaid , Required |
name | string | |
details | string | |
duration | nullable, integer | |
recommended | boolean | |
private | boolean | |
assigns_collections | boolean | |
concurrency_limit | integer | |
collections | list of collections | |
download_files | boolean | |
prices | list of prices | |
free_trial | boolean | |
free_trial_days | integer | This field can be omitted when free_trial is False |
Example of body parameters
{
"type":"recurring",
"name":"Demo Plan",
"details":"<div><!--block-->This is the description of the Demo Plan</div>",
"duration":null,
"recommended":true,
"private":false,
"assigns_collections":true,
"concurrency_limit":"1",
"collections":[
"Prepaid"
], // Check special considerations about collections ahead
"download_files":false,
"prices":{
"ARS":0,
"USD":"1",
"EUR":0,
"MXN":"1",
"COP":0,
"PEN":0,
"CLP":0,
"AUD":0,
"UYU":0,
"BOB":0,
"PYG":0,
"BRL":0,
"INR":0,
"GTQ":0,
"HNL":0
},
"free_trial":true,
"free_trial_days":"15"
}
Response
Code | Descriptio |
---|---|
201 | Object Created |
422 | Validation error, the reason of the error will be described in the response |
Assigning Collections
To assign collections to the new plan you may query the following endpoint to get available values for your the collections
GET /integration-api/v1/dashboard/plans/collections
Response Example
{"CODE": "success",
"data": ["Collection 1",
"Testing Collection 2",
"Demo Collection",
"Most Recent",
"Most Read",
"For Children"]}
Retrieve
GET /integration-api/v1/dashboard/plans/
Parameters
option | type | endpoint |
---|---|---|
query | string, query parameter | /integration-api/v1/dashboard/plans?query='Test Plan' |
tip
Using query parameter you can search by name, type and details of the plans
Response
Code | Description |
---|---|
200 | Success |
404 | Object not found |
401 | Unauthenticated |
Response Example
{'CODE': 'success',
'data': {'assigns_collections': True,
'collections': ['Demo Collection 1', 'Demo Collection 2'],
'concurrency_limit': 1,
'created_at': '2021-05-21 15:34:36',
'customer': None,
'deleted_at': None,
'details': 'Este es un plan que servira de aula asociada a un '
'docente',
'download_files': 0,
'duration': 12,
'free_trial': 0,
'free_trial_days': 0,
'has_geolocalized_prices': False,
'id': 2696,
'name': 'Test Plan Name',
'prices': [],
'private': 1,
'recommended': False,
'type': 'prepaid',
'updated_at': '2021-05-21 15:34:36',
'url': 'https://unlimitedtestautomation.publicala.me/subscribe/2696?signature={random_hash}'}}
Update
PUT /integration-api/v1/dashboard/plans/{plan_id}
Body parameters
Parameter | Type | Description. |
---|---|---|
type | string | Valid values: recurring , prepaid , Required |
name | string | |
details | string | |
duration | nullable, integer | |
recommended | boolean | |
private | boolean | |
assigns_collections | boolean | |
concurrency_limit | integer | |
collections | list of collections | |
download_files | boolean | |
customer | string | |
invoice | string | |
file_name | string | |
upload_file | file | |
prices | list of prices | |
free_trial | boolean | |
free_trial_days | integer | This field can be omited when free_trial is False |
Example of body parameters
{
"type":"recurring",
"name":"Demo Plan",
"details":"<div><!--block-->This is the description of the Demo Plan</div>",
"duration":null,
"recommended":true,
"private":false,
"assigns_collections":true,
"concurrency_limit":"1",
"collections":[
"Prepaid"
],
"download_files":false,
"customer":"",
"invoice":"",
"file_name":"",
"upload_file":false,
"prices":{
"ARS":0,
"USD":"1",
"EUR":0,
"MXN":"1",
"COP":0,
"PEN":0,
"CLP":0,
"AUD":0,
"UYU":0,
"BOB":0,
"PYG":0,
"BRL":0,
"INR":0,
"GTQ":0,
"HNL":0
},
"free_trial":true,
"free_trial_days":"15"
}
Response
Code | Desctiption |
---|---|
204 | Object Updated |
422 | Validation error, the reason of the error will be described in the response |
info
Same rules apply for assigning collections