Superscription API documentation version v2
https://client-api.{environment}/api/superscription/v2
- environment: required (one of magine.com, tvoli.com - default: magine.com)
/users/{userId}
Client API
Gets the subscription snapshot of a user
get /users/{userId}/subscription
Gets the subscription snapshot of a user
URI Parameters
- userId: required (string)
Headers
- Magine-AccessToken: required (string)
A token that identifies a specific partner
Example:
25b70ae1-d2bd-4ae7-85f4-62026580c866
- Authorization: required (string)
Bearer {login token}
Example:
Bearer 4b6fbf80...
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- discounts: required (array of SubscriptionDiscount)
Items: SubscriptionDiscount
- discount: required (object)
- name: required (string)
- market: required (string)
- pack: (string)
- amount: required (integer)
- proRataAmount: (integer)
- endDate: (number)
Unix time stamp (seconds)
- discount: required (object)
- packs: required (array of SubscriptionPack)
Items: SubscriptionPack
- id: required (string)
- name: required (string)
- description: required (string)
- tagline: required (string)
- price: required (integer)
- grossPrice: required (integer)
- netPrice: required (integer)
- currency: required (string)
- countryCode: required (string)
- channels: required (array of Channel)
Items: Channel
- id: required (integer)
- listOrder: required (integer)
- name: required (string)
- logoLight: required (string)
- logoDark: required (string)
- tags: required (array of string)
- channelIds: required (array of integer)
- removedChannels: (array of integer)
- endDate: (number)
Unix time stamp (seconds)
- isFree: required (boolean)
- thirdpartyReference: (object)
- provider: required (object)
- name: required (one of GOOGLE, APPLE, AMAZON, ...)
- reference: required (string)
- provider: required (object)
- isInternal: required (boolean)
- usps: required (array of string)
- isSubscribed: required (boolean)
- topChannels: required (array of Channel)
Items: Channel
- id: required (integer)
- listOrder: required (integer)
- name: required (string)
- logoLight: required (string)
- logoDark: required (string)
- tags: required (array of string)
- tags: required (array of string)
- campaigns: required (array of Campaign)
Items: Campaign
- id: required (string)
- prefix: required (string)
- name: required (string)
- discountAmount: (integer)
- discountPercentage: (integer)
- pack: (string)
- start: required (number)
Unix time stamp (seconds)
- end: (number)
Unix time stamp (seconds)
- discountCycles: (integer)
- market: required (string)
- bulletPoints: required (array of string)
- signupOnly: (boolean)
- nextBillingDate: (number)
Unix time stamp (seconds)
- lastBillingDate: (number)
Unix time stamp (seconds)
- trialInfo: required (object)
- isTrial: required (boolean)
- trialEndDate: (number)
Unix time stamp (seconds)
- length: (object)
- months: required (integer)
- days: required (integer)
- monthlyGrossPrice: required (integer)
- monthlyNetPrice: required (integer)
- currency: required (string)
- readTimestamp: (number)
Unix time stamp (seconds)
- freeRider: required (boolean)
- externalBilling: (string)
- status: required (one of NO_SUBSCRIPTION, EXPIRING_SUBSCRIPTION, ACTIVE_SUBSCRIPTION)
Example:
{
"campaigns": [],
"currency": "SEK",
"discounts": [],
"freeRider": false,
"monthlyGrossPrice": 0,
"monthlyNetPrice": 0,
"packs": [
{
"channelIds": [
135,
136
],
"channels": [
{
"id": 135,
"listOrder": 1,
"logoDark": "http://images.tvoli.com/channel-logos/135_dark.png",
"logoLight": "http://images.tvoli.com/channel-logos/135.png",
"name": "SVT1",
"tags": [
"popular",
"entertainment"
]
},
{
"id": 136,
"listOrder": 2,
"logoDark": "http://images.tvoli.com/channel-logos/136_dark.png",
"logoLight": "http://images.tvoli.com/channel-logos/136.png",
"name": "SVT2",
"tags": [
"popular",
"entertainment"
]
}
],
"countryCode": "SE",
"currency": "SEK",
"description": "Du f\u00e5r alltid detta paket och det \u00e4r alltid gratis",
"grossPrice": 0,
"id": "0FREESEPAC",
"isFree": true,
"isInternal": false,
"isSubscribed": true,
"name": "Free",
"netPrice": 0,
"price": 0,
"tagline": "",
"tags": [],
"topChannels": [
{
"id": 135,
"listOrder": 1,
"logoDark": "http://images.tvoli.com/channel-logos/135_dark.png",
"logoLight": "http://images.tvoli.com/channel-logos/135.png",
"name": "SVT1",
"tags": [
"popular",
"entertainment"
]
},
{
"id": 136,
"listOrder": 2,
"logoDark": "http://images.tvoli.com/channel-logos/136_dark.png",
"logoLight": "http://images.tvoli.com/channel-logos/136.png",
"name": "SVT2",
"tags": [
"popular",
"entertainment"
]
}
],
"usps": [
"P\u00e5 alla dina enheter",
"Ett paket som passar alla",
"V\u00e5ra mest popul\u00e4ra kanaler"
]
}
],
"status": "NO_SUBSCRIPTION",
"trialInfo": {
"isTrial": true,
"length": {
"days": 7,
"months": 0
}
}
}
HTTP status code 400
Bad user id format
HTTP status code 401
Authorization failed
Cancel subscription to products
put /users/{userId}/subscription/cancel
Cancel subscription to products
URI Parameters
- userId: required (string)
Headers
- Magine-AccessToken: required (string)
A token that identifies a specific partner
Example:
25b70ae1-d2bd-4ae7-85f4-62026580c866
- Authorization: required (string)
Bearer {login token}
Example:
Bearer 4b6fbf80...
Body
Media type: application/json
Type: object
Properties- productIds: required (array of string)
list of Magine Pack id:s
- source: required (string)
"user" | "internal" | "dunning"
Example:
{
"productIds":["0000001PKG"],
"source": "user"
}
Check if the user is allowed to buy packs through a third party payment provider (e.g. google) IAP. Use the http status code + json "errors" field to determine exact cause of failures.
get /users/{userId}/thirdparty/{thirdpartyName}/canbuy
Check if the user is allowed to buy packs through a third party payment provider (e.g. google) IAP. Use the http status code + json "errors" field to determine exact cause of failures.
URI Parameters
- userId: required (string)
- thirdpartyName: required (one of GOOGLE, APPLE, AMAZON, ...)
Headers
- Magine-AccessToken: required (string)
A token that identifies a specific partner
Example:
25b70ae1-d2bd-4ae7-85f4-62026580c866
- Authorization: required (string)
Bearer {login token}
Example:
Bearer 4b6fbf80...
HTTP status code 204
HTTP status code 400
Body
Media type: application/json
Type: object
Properties- message: required (string)
- code: required (integer)
- errors: required (array of CanBuyError)
Items: CanBuyError
- reason: required (one of ERR_MISSING_USER_ID, ERR_MISMATCH_USER_ID, ERR_HAS_OTHER_PROVIDER_PACKS)
Example:
{
"code": 400,
"errors": [
{
"reason": "ERR_MISSING_USER_ID"
}
],
"message": "MissingThirdPartyUserId"
}
HTTP status code 401
Authorization failed or the userId parameters in the uri do not correspond to those in the Authorization header
Check if the user is allowed to buy packs through amazon IAP. Use the http status code + json "errors" field to determine exact cause of failures.
get /users/{userId}/thirdparty/{thirdpartyName}/canbuy/{amazonLwaId}
Check if the user is allowed to buy packs through amazon IAP. Use the http status code + json "errors" field to determine exact cause of failures.
URI Parameters
- userId: required (string)
- thirdpartyName: required (one of GOOGLE, APPLE, AMAZON, ...)
- amazonLwaId: required (string)
Headers
- Magine-AccessToken: required (string)
A token that identifies a specific partner
Example:
25b70ae1-d2bd-4ae7-85f4-62026580c866
- Authorization: required (string)
Bearer {login token}
Example:
Bearer 4b6fbf80...
HTTP status code 204
HTTP status code 400
Body
Media type: application/json
Type: object
Properties- message: required (string)
- code: required (integer)
- errors: required (array of CanBuyError)
Items: CanBuyError
- reason: required (one of ERR_MISSING_USER_ID, ERR_MISMATCH_USER_ID, ERR_HAS_OTHER_PROVIDER_PACKS)
Example:
{
"code": 400,
"errors": [
{
"reason": "ERR_MISSING_USER_ID"
}
],
"message": "MissingThirdPartyUserId"
}
HTTP status code 401
Authorization failed or the userId parameters in the uri do not correspond to those in the Authorization header
get /users/{userId}/market/{market}/price
URI Parameters
- userId: required (string)
- market: required (string)
2-letter Country code (DE, SE...)
Query Parameters
- productIds: required (string)
Comma separated string values
- promoCode: (string)
- userId: (string)
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- grossPrice: required (integer)
- netPrice: required (integer)
- monthlyGrossPrice: required (integer)
- monthlyNetPrice: required (integer)
- discounts: required (array of SubscriptionDiscount)
Items: SubscriptionDiscount
- discount: required (object)
- name: required (string)
- market: required (string)
- pack: (string)
- amount: required (integer)
- proRataAmount: (integer)
- endDate: (number)
Unix time stamp (seconds)
- discount: required (object)
- currency: required (string)
- fromDate: required (number)
Unix time stamp (seconds)
- toDate: required (number)
Unix time stamp (seconds)
- trial: required (object)
- eligible: required (boolean)
- days: (integer)
- packs: required (array of SubscriptionPack)
Items: SubscriptionPack
- id: required (string)
- name: required (string)
- description: required (string)
- tagline: required (string)
- price: required (integer)
- grossPrice: required (integer)
- netPrice: required (integer)
- currency: required (string)
- countryCode: required (string)
- channels: required (array of Channel)
Items: Channel
- id: required (integer)
- listOrder: required (integer)
- name: required (string)
- logoLight: required (string)
- logoDark: required (string)
- tags: required (array of string)
- channelIds: required (array of integer)
- removedChannels: (array of integer)
- endDate: (number)
Unix time stamp (seconds)
- isFree: required (boolean)
- thirdpartyReference: (object)
- provider: required (object)
- name: required (one of GOOGLE, APPLE, AMAZON, ...)
- reference: required (string)
- provider: required (object)
- isInternal: required (boolean)
- usps: required (array of string)
- isSubscribed: required (boolean)
- topChannels: required (array of Channel)
Items: Channel
- id: required (integer)
- listOrder: required (integer)
- name: required (string)
- logoLight: required (string)
- logoDark: required (string)
- tags: required (array of string)
- tags: required (array of string)
- campaign: (array of Campaign)
Items: Campaign
- id: required (string)
- prefix: required (string)
- name: required (string)
- discountAmount: (integer)
- discountPercentage: (integer)
- pack: (string)
- start: required (number)
Unix time stamp (seconds)
- end: (number)
Unix time stamp (seconds)
- discountCycles: (integer)
- market: required (string)
- bulletPoints: required (array of string)
- signupOnly: (boolean)
- overlapWarnings: (array of OverlapWarning)
Items: OverlapWarning
- partial: (object)
- a: required (string)
- b: required (string)
- complete: (object)
- subset: required (string)
- superset: required (string)
- partial: (object)
- monthlyNetPriceChange: required (integer)
- monthlyGrossPriceChange: required (integer)
Example:
{
"currency": "SEK",
"discounts": [],
"fromDate": 1478178154151,
"grossPrice": 0,
"monthlyGrossPrice": 2900,
"monthlyGrossPriceChange": 2900,
"monthlyNetPrice": 2900,
"monthlyNetPriceChange": 2900,
"netPrice": 0,
"overlapWarnings": [],
"packs": [
{
"channelIds": [ 10925 ],
"channels": [
{
"id": 10925,
"listOrder": 46,
"logoDark": "http://images.tvoli.com/channel-logos/10925_dark.png",
"logoLight": "http://images.tvoli.com/channel-logos/10925.png",
"name": "Polonia 1",
"tags": [ "international" ]
}
],
"countryCode": "SE",
"currency": "SEK",
"description": "Polsk TV till din dator, smartphone, tablet eller Smart TV.",
"grossPrice": 2900,
"id": "00012SEPAC",
"isFree": false,
"isInternal": false,
"isSubscribed": false,
"name": "Polski",
"netPrice": 2900,
"price": 2900,
"tagline": "En liten bit av Polen, p\u00e5 alla dina sk\u00e4rmar.",
"tags": [ "medium", "theme" ],
"topChannels": [
{
"id": 10925,
"listOrder": 46,
"logoDark": "http://images.tvoli.com/channel-logos/10925_dark.png",
"logoLight": "http://images.tvoli.com/channel-logos/10925.png",
"name": "Polonia 1",
"tags": [ "international" ]
}
],
"usps": [
"En liten bit av Polen",
"3 kanaler",
"Ingen bindningstid"
]
}
],
"toDate": 1478782954151,
"trial": {
"days": 7,
"eligible": true
}
}
HTTP status code 400
Bad input data (Provided market and/or productIds invalid or not found)
/admin/users/{userId}
Backend-to-backend API
Get subscription of a users
get /admin/users/{userId}/subscription
Get subscription of a users
URI Parameters
- userId: required (string)
Headers
- Authorization: required (string)
Bearer {api key}
Example:
Bearer 4b6fbf80...
HTTP status code 200
Body
Media type: application/json
Type: object
Properties- discounts: required (array of SubscriptionDiscount)
Items: SubscriptionDiscount
- discount: required (object)
- name: required (string)
- market: required (string)
- pack: (string)
- amount: required (integer)
- proRataAmount: (integer)
- endDate: (number)
Unix time stamp (seconds)
- discount: required (object)
- packs: required (array of SubscriptionPack)
Items: SubscriptionPack
- id: required (string)
- name: required (string)
- description: required (string)
- tagline: required (string)
- price: required (integer)
- grossPrice: required (integer)
- netPrice: required (integer)
- currency: required (string)
- countryCode: required (string)
- channels: required (array of Channel)
Items: Channel
- id: required (integer)
- listOrder: required (integer)
- name: required (string)
- logoLight: required (string)
- logoDark: required (string)
- tags: required (array of string)
- channelIds: required (array of integer)
- removedChannels: (array of integer)
- endDate: (number)
Unix time stamp (seconds)
- isFree: required (boolean)
- thirdpartyReference: (object)
- provider: required (object)
- name: required (one of GOOGLE, APPLE, AMAZON, ...)
- reference: required (string)
- provider: required (object)
- isInternal: required (boolean)
- usps: required (array of string)
- isSubscribed: required (boolean)
- topChannels: required (array of Channel)
Items: Channel
- id: required (integer)
- listOrder: required (integer)
- name: required (string)
- logoLight: required (string)
- logoDark: required (string)
- tags: required (array of string)
- tags: required (array of string)
- campaigns: required (array of Campaign)
Items: Campaign
- id: required (string)
- prefix: required (string)
- name: required (string)
- discountAmount: (integer)
- discountPercentage: (integer)
- pack: (string)
- start: required (number)
Unix time stamp (seconds)
- end: (number)
Unix time stamp (seconds)
- discountCycles: (integer)
- market: required (string)
- bulletPoints: required (array of string)
- signupOnly: (boolean)
- nextBillingDate: (number)
Unix time stamp (seconds)
- lastBillingDate: (number)
Unix time stamp (seconds)
- trialInfo: required (object)
- isTrial: required (boolean)
- trialEndDate: (number)
Unix time stamp (seconds)
- length: (object)
- months: required (integer)
- days: required (integer)
- monthlyGrossPrice: required (integer)
- monthlyNetPrice: required (integer)
- currency: required (string)
- readTimestamp: (number)
Unix time stamp (seconds)
- freeRider: required (boolean)
- externalBilling: (string)
- status: required (one of NO_SUBSCRIPTION, EXPIRING_SUBSCRIPTION, ACTIVE_SUBSCRIPTION)
Example:
{
"campaigns": [],
"currency": "SEK",
"discounts": [],
"freeRider": false,
"monthlyGrossPrice": 0,
"monthlyNetPrice": 0,
"packs": [
{
"channelIds": [
135,
136
],
"channels": [
{
"id": 135,
"listOrder": 1,
"logoDark": "http://images.tvoli.com/channel-logos/135_dark.png",
"logoLight": "http://images.tvoli.com/channel-logos/135.png",
"name": "SVT1",
"tags": [
"popular",
"entertainment"
]
},
{
"id": 136,
"listOrder": 2,
"logoDark": "http://images.tvoli.com/channel-logos/136_dark.png",
"logoLight": "http://images.tvoli.com/channel-logos/136.png",
"name": "SVT2",
"tags": [
"popular",
"entertainment"
]
}
],
"countryCode": "SE",
"currency": "SEK",
"description": "Du f\u00e5r alltid detta paket och det \u00e4r alltid gratis",
"grossPrice": 0,
"id": "0FREESEPAC",
"isFree": true,
"isInternal": false,
"isSubscribed": true,
"name": "Free",
"netPrice": 0,
"price": 0,
"tagline": "",
"tags": [],
"topChannels": [
{
"id": 135,
"listOrder": 1,
"logoDark": "http://images.tvoli.com/channel-logos/135_dark.png",
"logoLight": "http://images.tvoli.com/channel-logos/135.png",
"name": "SVT1",
"tags": [
"popular",
"entertainment"
]
},
{
"id": 136,
"listOrder": 2,
"logoDark": "http://images.tvoli.com/channel-logos/136_dark.png",
"logoLight": "http://images.tvoli.com/channel-logos/136.png",
"name": "SVT2",
"tags": [
"popular",
"entertainment"
]
}
],
"usps": [
"P\u00e5 alla dina enheter",
"Ett paket som passar alla",
"V\u00e5ra mest popul\u00e4ra kanaler"
]
}
],
"status": "NO_SUBSCRIPTION",
"trialInfo": {
"isTrial": true,
"length": {
"days": 7,
"months": 0
}
}
}
HTTP status code 400
Bad user id format
HTTP status code 401
Authorization failed
Add products to subscription
post /admin/users/{userId}/subscription/add
Add products to subscription
URI Parameters
- userId: required (string)
Headers
- Authorization: required (string)
Bearer {api key}
Example:
Bearer 4b6fbf80...
Body
Media type: application/json
Type: object
Properties- productIds: required (array of string)
list of Magine Pack id:s
- source: required (string)
"user" | "internal" | "dunning"
Example:
{
"productIds":["0000001PKG"],
"source": "user"
}
Cancel subscription to products
post /admin/users/{userId}/subscription/cancel
Cancel subscription to products
URI Parameters
- userId: required (string)
Headers
- Authorization: required (string)
Bearer {api key}
Example:
Bearer 4b6fbf80...
Body
Media type: application/json
Type: object
Properties- productIds: required (array of string)
list of Magine Pack id:s
- source: required (string)
"user" | "internal" | "dunning"
Example:
{
"productIds":["0000001PKG"],
"source": "user"
}
Add third-party products to subscription
post /admin/users/{userId}/thirdparty/{thirdpartyName}/add
Add third-party products to subscription
URI Parameters
- userId: required (string)
- thirdpartyName: required (one of GOOGLE, APPLE, AMAZON, ...)
Headers
- Authorization: required (string)
Bearer {api key}
Example:
Bearer 4b6fbf80...
Body
Media type: application/json
Type: object
Properties- providerProductIds: required (array of string)
list of third-party references
Example:
{
"providerProductIds":["providersProductId_01", "providersProductId_02"]
}
Cancel subscription to third-party products
post /admin/users/{userId}/thirdparty/{thirdpartyName}/cancel
Cancel subscription to third-party products
URI Parameters
- userId: required (string)
- thirdpartyName: required (one of GOOGLE, APPLE, AMAZON, ...)
Headers
- Authorization: required (string)
Bearer {api key}
Example:
Bearer 4b6fbf80...
Body
Media type: application/json
Type: object
Properties- providerProductIds: required (array of string)
list of third-party references
Example:
{
"providerProductIds":["providersProductId_01", "providersProductId_02"]
}