Custom Subscriptions

API for managing Custom Subscription

get
List Custom Subscriptions

https://www.magloft.com/api/portal/v1/custom_subscriptions/:app_id
This endpoint returns a list of all custom subscriptions that belong to the magazine
Request
Response
Path Parameters
app_id
required
String
App ID (Publication) to scope this request for.
200: OK
{
"id": 1234,
"order_id": "sub-12345",
"source": "custom",
"user_id": "FF063C1C-C5F3-4749-A7FC-7DCF91B3278F",
"active": true,
"start_date": "2018-01-24",
"end_date": "2018-01-24",
"created_at": "2018-01-24 10:55:35",
"reader": {
"id": 12345,
"email": "user@magloft.com",
"custom_data": {
"gender": "male"
},
"confirmed": true
},
"status": "updated",
"password": "pass1234"
}

get
List Custom Subscriptions Page

https://www.magloft.com/api/portal/v1/custom_subscriptions/:app_id/page/:page
This endpoint returns a page list of all custom subscriptions that belong to the magazine
Request
Response
Path Parameters
app_id
required
String
App ID (Publication) to scope this request for.
page
optional
Integer
The page number to list
Query Parameters
per_page
optional
Integer
Number of items to show per page
order_by
optional
Symbol
Field to sort results by
order_dir
optional
Symbol
Direction (asc, desc) to sort results by
filter
optional
String
Text filter to search results by
200: OK
{
"total": 1,
"page": 1,
"records": [
{
"id": 1234,
"order_id": "sub-12345",
"source": "custom",
"user_id": "FF063C1C-C5F3-4749-A7FC-7DCF91B3278F",
"active": true,
"start_date": "2018-01-24",
"end_date": "2018-01-24",
"created_at": "2018-01-24 10:55:35",
"reader": {
"id": 12345,
"email": "user@magloft.com",
"custom_data": {
"gender": "male"
},
"confirmed": true
},
"status": "updated",
"password": "pass1234"
}
]
}

get
Get Custom Subscription

https://www.magloft.com/api/portal/v1/custom_subscriptions/:app_id/(:email)(:id)
This endpoint returns a specific custom subscription by id
Request
Response
Path Parameters
app_id
required
String
App ID (Publication) to scope this request for.
email
optional
String
Email address of the reader account
id
optional
Integer
Subscription ID
200: OK
{
"id": 1234,
"order_id": "sub-12345",
"source": "custom",
"user_id": "FF063C1C-C5F3-4749-A7FC-7DCF91B3278F",
"active": true,
"start_date": "2018-01-24",
"end_date": "2018-01-24",
"created_at": "2018-01-24 10:55:35",
"reader": {
"id": 12345,
"email": "user@magloft.com",
"custom_data": {
"gender": "male"
},
"confirmed": true
},
"status": "updated",
"password": "pass1234"
}

post
Create Custom Subscription

https://www.magloft.com/api/portal/v1/custom_subscriptions/:app_id
This endpoint creates a new custom subscription and returns the saved custom subscription
Request
Response
Path Parameters
app_id
required
String
App ID (Publication) to scope this request for.
Body Parameters
email
required
String
Email address of the reader account
password
optional
String
Plain-text password of Reader account shown only when creating a new subscription without specifying a password
start_date
optional
string
Date from which the subscription should be valid (inclusive), format YYYY-MM-DD
end_date
optional
string
Date until which the subscription should be valid (inclusive) format YYYY-MM-DD
active
optional
boolean
Boolean indicating whether the subscription is currently active
custom_data
optional
Hash
Hash containing custom data (string key, string value) of a reader
firstname
optional
String
First name of the Custom Subscription's reader
lastname
optional
String
Last name of the Custom Subscription's reader
confirmation
optional
boolean
Boolean to indicate whether to send a confirmation email
200: OK
{
"id": 1234,
"order_id": "sub-12345",
"source": "custom",
"user_id": "FF063C1C-C5F3-4749-A7FC-7DCF91B3278F",
"active": true,
"start_date": "2018-01-24",
"end_date": "2018-01-24",
"created_at": "2018-01-24 10:55:35",
"reader": {
"id": 12345,
"email": "user@magloft.com",
"custom_data": {
"gender": "male"
},
"confirmed": true
},
"status": "updated",
"password": "pass1234"
}

put
Update Custom Subscription

https://www.magloft.com/api/portal/v1/custom_subscriptions/:app_id/:id
This endpoint updates a specific custom subscription by id and returns the updated custom subscription
Request
Response
Path Parameters
app_id
required
String
App ID (Publication) to scope this request for.
id
required
Integer
Subscription ID
Body Parameters
start_date
optional
string
Date from which the subscription should be valid (inclusive), format YYYY-MM-DD
end_date
optional
string
Date until which the subscription should be valid (inclusive), format YYYY-MM-DD
active
optional
boolean
Boolean indicating whether the subscription is currently active
custom_data
optional
Hash
Hash containing custom data (string key, string value) of a reader
200: OK
{
"id": 1234,
"order_id": "sub-12345",
"source": "custom",
"user_id": "FF063C1C-C5F3-4749-A7FC-7DCF91B3278F",
"active": true,
"start_date": "2018-01-24",
"end_date": "2018-01-24",
"created_at": "2018-01-24 10:55:35",
"reader": {
"id": 12345,
"email": "user@magloft.com",
"custom_data": {
"gender": "male"
},
"confirmed": true
},
"status": "updated",
"password": "pass1234"
}

delete
Delete Custom Subscription

https://www.magloft.com/api/portal/v1/custom_subscriptions/:app_id/:id
This endpoint deletes a specific custom subscription by id and returns an empty response with status 204
Request
Response
Path Parameters
app_id
required
String
App ID (Publication) to scope this request for.
id
required
Integer
Subscription ID
200: OK
null

get
Export Custom Subscriptions

https://www.magloft.com/api/portal/v1/custom_subscriptions/:app_id/export.csv
This endpoint returns a csv document that contains a spreadsheet of all custom subscriptions
Request
Response
Path Parameters
app_id
required
String
App ID (Publication) to scope this request for.
200: OK
null