API reference
Subscription API
Subscription API allows a subscriber to register or unregister to or from an app, send subscription notification, query subscription status and query subscriber base size.
- Base URL
- https://api.mspace.lk
- Content type
- application/json;charset=utf-8
- Endpoints
- 6
User Subscription
https://api.mspace.lk/subscription/sendThis service handles user subscription process(subscription/unsubscription)
Request bodyapplication/json;charset=utf-8
applicationIdstringRequiredUsed to identify the application. This is a unique identifier generated while provisioning an application.
Only a single value can be sent per request.
Example:APP_999999passwordstringRequiredUsed to authenticate the application originated message against the credentials of the service provider.
Encoded, single value.
Example:95904999aa8edb0c038b3295fdd271desubscriberIdstringRequiredThis can be the MSISDN of the subscriber to be charged. This is a unique identifier.
tel: is for MSISDN
Subcriber: tel:94716177301
Note: tel might be a masked number depending on the type of the application
Only a single value can be sent per request.
Example:tel:94716177301actionstringRequired0 -user unsubscription
1 -user subscription
Enum:01Example:0
{
"applicationId": "APP_999999",
"password": "95904999aa8edb0c038b3295fdd271de",
"subscriberId": "tel:94716177301",
"action": "0"
}Response200 successapplication/json;charset=utf-8
versionstringRequiredAPI version shall be numbered as 1.0, 2.0 etc.
If version is specified in the request, same version must be sent in the response.
If version is not specified in the request, the latest version will be specified in the response.
Example:1.0.statusCodestringRequiredThe status code for the entire request.
Note: When the request is successful, statusCode will be S1000.
Example:S1000statusDetailstringRequiredDescription of the status for the entire request.
S1000 - Request was successfully processed.
E1346 - Subscription request for < MSISDN > could not be processed as the subscription rate limit has been exceeded. Maximum of < MAX_SUBS_PER_WINDOW > subscription attempts allowed within < WINDOW_SECONDS > seconds. Please try again after < retryAfter > seconds.
E1347 - Subscription request for < MSISDN > could not be processed as the maximum active subscription limit of < MAX_ACTIVE_SUBS > has been reached. The subscriber must unsubscribe from an existing application before subscribing to a new one.
Note: E1346 and E1347 are returned only for subscription requests (action = 1).
Example:not registeredsubscriptionStatusstringRequiredStatus of the subscription eg:UNREGISTERED,REGISTERED
Example:UNREGISTERED.
{
"version": "1.0.",
"statusCode": "S1000",
"statusDetail": "not registered",
"subscriptionStatus": "UNREGISTERED."
}{
"version": "1.0",
"statusCode": "E1347",
"statusDetail": "Subscription request for tel:94716177301 could not be processed as the maximum active subscription limit of 20 has been reached. The subscriber must unsubscribe from an existing application before subscribing to a new one.",
"subscriptionStatus": "UNREGISTERED"
}Code samples (Java, PHP, javaScript, .net): coming soon
Base Size
https://api.mspace.lk/subscription/query-baseThis service returns the number of registered subscribers
Request bodyapplication/json;charset=utf-8
applicationIdstringRequiredUsed to identify the application. This is a unique identifier generated while provisioning an application.
Only a single value can be sent per request.
Example:APP_000201passwordstringRequiredUsed to authenticate the application originated message against the credentials of the service provider.
Encoded, single value.
Example:39a8d1cb245029d0560619a2b388669c
{
"applicationId": "APP_000201",
"password": "39a8d1cb245029d0560619a2b388669c"
}Response200 successapplication/json;charset=utf-8
baseSizestringRequiredNumber of registered users
Example:0versionstringRequiredAPI version shall be numbered as 1.0, 2.0 etc.
If version is specified in the request, same version must be sent in the response.
If version is not specified in the request, the latest version will be specified in the response.
Example:1.0.statusCodestringRequiredThe status code for the entire request.
Example:S1000statusDetailstringRequiredDescription of the status for the entire request.
Example:Success.
{
"baseSize": "0",
"version": "1.0.",
"statusCode": "S1000",
"statusDetail": "Success."
}Code samples (Java, PHP, javaScript, .net): coming soon
Subscriber Status
https://api.mspace.lk/subscription/getStatusThis service returns the user subscription status(unregistered,registered)
Request bodyapplication/json;charset=utf-8
applicationIdstringRequiredUnique identification of the application within the platform
Example:APP_999999passwordstringRequiredPassword given when provisioning the application
Example:95904999aa8edb0c038b3295fdd271desubscriberIdstringRequiredThis is the MSISDN of the subscriber to be charged
Example:tel:94716177301
{
"applicationId": "APP_999999",
"password": "95904999aa8edb0c038b3295fdd271de",
"subscriberId": "tel:94716177301"
}Response200 successapplication/json;charset=utf-8
versionstringRequiredAPI version shall be numbered as 1.0, 2.0 etc.
If version is specified in the request, same version must be sent in the response.
If version is not specified in the request, the latest version will be specified in the response.
Example:1.0.statusCodestringRequiredThe status code for the entire request.
Example:S1000statusDetailstringRequiredDescription of the status for the entire request.
Example:Request was successfully processedsubscriptionStatusstringRequiredStatus of the subscription INITIAL,REG_PENDING,TRIAL,
REGISTERED,UNREGISTERED and TEMPORARY_BLOCKED
Example:UNREGISTERED.
{
"version": "1.0.",
"statusCode": "S1000",
"statusDetail": "Request was successfully processed",
"subscriptionStatus": "UNREGISTERED."
}Code samples (Java, PHP, javaScript, .net): coming soon
Get Subscriber Charging Info
https://api.mspace.lk/subscription/getSubscriberChargingInfoRequest bodyapplication/json;charset=utf-8
applicationIdstringRequiredUnique identification of the application within the platform
Example:APP_102672passwordstringRequiredPassword given when provisioning the application
Example:cf2b9e361c13bc54b86d3c8180b0582fdsubscriberIdsstringOptionalMSISDNs of the list of subscribers. Eg: [tel: 94712342345, tel: 94712678845, tel:9471982563]
If the application accepts masked numbers, list of
masked numbers must be communicated in this parameter
List can contain maximum of 10 MSISDNs per request
Example:["tel: 94712342345","tel: 94712678845","tel: 9471982563"]
{
"applicationId": "APP_102672",
"password": "cf2b9e361c13bc54b86d3c8180b0582fd",
"subscriberIds": [
"tel: 94712342345",
"tel: 94712678845",
"tel: 9471982563"
]
}Response200 successapplication/json;charset=utf-8
versionstringRequired- Example:
1.0 destinationResponsesarray of objectsOptionalArray item fields
subscriberIdstringRequiredMSISDN of the subscriber.
If the application accepts masked numbers,
list of masked numbers must be communicated in this parameter
THIS IS A MANDATORY FILED
Example:tel:94712342345subscriptionStatusstringOptionalStatus of the subscription
Eg: INITIAL,
REG_PENDING, TRIAL, REGISTERED,
UNREGISTERED and TEMPORARY_BLOCKED
Example:REGISTEREDlastChargedDatestringOptionalThe successful last charged date of the subscriber
in the format of YYYY-MM-DD hh:mm:ss
Example:2020-01-23 22:03:22lastChargedAmountstringOptionalThe successful last charged amount for the
subscriber with the currency code
Example:30.00 LKRnumberTypestringOptionalDenotes whether the subscriber is prepaid or postpaid
Example:postpaidstatusCodestringOptionalSuccess or error code for each subscriber and for
the entire request
Example:S1000statusDetailstringOptional- Example:
Request was successfully processes
statusCodestringRequiredThe status code for the entire request
Example:S1000statusDetailstringRequiredBelow table provides information on different subscription statuses returned
by the getSubscriptionChargingInfo service.
INITIAL - Subscription request is sent to the system. The subscription request
might not be completed may be due to a system error. Not even the charging
call is made during this instance.
Parameters returns in response : subscriberId,subscriptionStatus,
numberType,statusCode,statusDetail
REG_PENDING - Subscription request is made and charging request is also sent
but charging is not yet success.(Eg: Charging response not yet received from the IN,
Insufficient balance)
Parameters returns in response : subscriberId,subscriptionStatus,
numberType,statusCode,statusDetail
TRIAL - Subscription request is made and the platform allows subscribers to use
the service without charging as they have a free trial period enabled.
Parameters returns in response : subscriberId,subscriptionStatus,
numberType,statusCode,statusDetail
REGISTERED - Subscription request is made, charging is successful and the
subscriber can receive the service.If the application registered to is a free
application lastChargedDate to be omitted and lastChargedAmount to be sent as
0.00 LKR
Parameters returns in response : subscriberId,subscriptionStatus,
lastChargedDate,lastChargedAmount,numberType,statusCode,statusDetail
UNREGISTERED - Subscription request is made and unsubscription is also
done by the subscriber for the particular service.If the application unregistered
from is a free application lastChargedDate to be omitted and lastChargedAmount to be
sent as 0.00 LKR
Parameters returns in response : subscriberId,subscriptionStatus, lastChargedDate,lastChargedAmount,numberType,statusCode,statusDetail
TEMPORARY_BLOCKED - Subscription request is made initial charging was
also successful and was in the registered status once but
recursive charging has failed
(Eg: Due to insufficient balance) and service is temporarily blocked for this subscriber
If the application registered to is a free
application lastChargedDate to be omitted and lastChargedAmount to be sent as 0.00 LKR
Parameters returns in response : subscriberId,subscriptionStatus,lastChargedDate,lastChargedAmount,
numberType,statusCode,statusDetail
The status detail for the entire request
S1000 - Process completed successfully for all the available destination numbers.
E1303 - IP address from which this request originated is not provisioned to send request to application <application-id>. Please use a provisioned system to send request or contact system admin to provision the new IP.
E1312 - Request is Invalid. <specify_the_reason> Refer the TAP NBL API Developer Guide for the mandatory fields and correct format of the request.
E1313 - Authentication failed. No such active application with applicationId <application-id>, or no active service provider or the given password in the request is invalid.
E1317 - < MSISDN > in request is invalid or not allowed.
E1325 - Format of the address is invalid. Expected format is tel: 94712342345.
E1601 - System experienced an unexpected error.
E1603 - Temporary System Error occurred while delivering your request
Example:Success.
{
"version": "1.0",
"destinationResponses": [
{
"subscriberId": "tel:94712342345",
"subscriptionStatus": "REGISTERED",
"lastChargedDate": "2020-01-23 22:03:22",
"lastChargedAmount": "30.00 LKR",
"numberType": "postpaid",
"statusCode": "S1000",
"statusDetail": "Request was successfully processes"
}
],
"statusCode": "S1000",
"statusDetail": "Success."
}Code samples (Java, PHP, javaScript, .net): coming soon
Subscriber Notifications
https://api.mspace.lk/subscription/notifyThis service sends notifications to the users
Request bodyapplication/json;charset=utf-8
timeStampstringRequiredThe timestamp sent from the SMS. "yyMMddHHmm" yy – last two digits of the year (00-99) MM – month (01-12) dd – day (01-31) HH – hour (00-23) mm- minute (00-59)
Example:20120113082110versionstringRequiredAPI version shall be numbered as 1.0, 2.0 etc.
If version is specified in the request, same version must be sent in the response.
If version is not specified in the request, the latest version will be specified in the response.
Example:1.0applicationIdstringRequiredUsed to identify the application. This is a unique identifier generated while provisioning an application.
Only a single value can be sent per request.
Example:APP_999999passwordstringRequiredUsed to authenticate the application originated message against the credentials of the service provider.
Encoded, single value.
Example:95904999aa8edb0c038b3295fdd271desubscriberIdstringRequiredThis can be the MSISDN of the subscriber to be charged. This is a unique identifier.
tel:94716177301 is for MSISDN
Subcriber: tel:94716177301
Note: tel might be a masked number depending on the type of the application
Only a single value can be sent per request.
Example:tel:94716177301frequencystringRequiredFrequency of notifications being sent
Enum:dailyweeklymonthlyyearlyExample:monthlystatusstringRequiredStatus of the subscription eg:UNREGISTERED,REGISTERED
Example:REGISTERED.
{
"timeStamp": "20120113082110",
"version": "1.0",
"applicationId": "APP_999999",
"password": "95904999aa8edb0c038b3295fdd271de",
"subscriberId": "tel:94716177301",
"frequency": "monthly",
"status": "REGISTERED."
}Response200 successapplication/json;charset=utf-8
statusCodestringRequiredThe status code for the entire request.
Example:S1000statusDetailstringRequiredDescription of the status for the entire request.
Example:Request was successfully processed
{
"statusCode": "S1000",
"statusDetail": "Request was successfully processed"
}Code samples (Java, PHP, javaScript, .net): coming soon
Subscriber List
https://api.mspace.lk/subscription/getSubscriberListThis service provides an opportunity for the developers to retrieve subscriber list. This API allows the developer to stay updated with the subscription notifications which he/she has missed receiving.
Request bodyapplication/json;charset=utf-8
applicationIdstringRequiredUnique identification of the application within the platform
Example:APP_102672passwordstringRequiredPassword given when provisioning the application
Example:cf2b9e361c13bc54b86d3c8180b0582fdversionstringOptionalAPI version
Example:1.0requestPageIntegerRequiredThe specific page number from a list of pages containing subscription notifications.
Example:2
{
"applicationId": "APP_102672",
"password": "cf2b9e361c13bc54b86d3c8180b0582fd",
"version": "1.0",
"requestPage": 2
}Response200 successapplication/json;charset=utf-8
versionstringRequiredAPI version shall be numbered as 1.0, 2.0 etc. If version is specified in the request, same version must be sent in the response. If version is not specified in the request, the latest version will be specified in the response
Example:1.0statusCodestringRequiredSucces or error code for each subscriber and for the entire request
Enum:S1000S1001E1100E1102E1103E1104E1105E1106E1107Example:S1000statusDetailstringRequiredDescription corresponding to the status code
S1000 Request Was Successfully Processed.
S1001 No Subscribers Found
E1100 System Experienced an Unexpected Error.
E1102 Service Provider Is Not In Active Status.
E1103 Request Parameters are Invalid. Refer the API Documentation
E1104 Application is Not in Active or Limited Production Status.
E1105 TPS Exceeded
E1106 Invalid Request Page, Page Number Should Be 1 Or Greater
E1107 Request Is Invalid.
Refer The API Documentation For The Mandatory Fields And Correct Format Of The Request.
Example:Request was successfully processednextPageNumberIntegerRequiredDisplay the next page number available. If there is no page available next, -1 will be displayed.
Example:3moreDataAvailableBooleanRequiredIndicates if there is more data available
Example:truesubscribersobjectOptionalObject fields
subscriberIdstringRequiredMSISDN of the subscriber
Eg: tel: 94712342345
If the application accepts masked numbers, list of masked numbers must be communicated in this parameter
Example:tel: 94712342345subscriptionStatusstringOptionalStatus of the subscription Eg: TRIAL, REGISTERED and TEMPORARY_BLOCKED
Example:REGISTEREDlastChargedDatestringOptionalThe successful last charged date of the subscriber in the format of "YYYY-MM-DD" "hh:mm:ss"
Example:2020-01-23 22.03.22lastChargedAmountstringOptionalThe successful last charged amount for the subscriber with the currency code
Example:30.00 LKR
{
"version": "1.0",
"statusCode": "S1000",
"statusDetail": "Request was successfully processed",
"nextPageNumber": 3,
"moreDataAvailable": "true",
"subscribers": {
"subscriberId": "tel: 94712342345",
"subscriptionStatus": "REGISTERED",
"lastChargedDate": "2020-01-23 22.03.22",
"lastChargedAmount": "30.00 LKR"
}
}Code samples (Java, PHP, javaScript, .net): coming soon