Skip to content

WRSDP Documentation ​

Overview ​

Welcome to the EnthalpyTech Digital Service API documentation. This document provides detailed information on how to interact with our API endpoints.

In this documentation, you will find the necessary endpoints for:

  • Generating a PIN
  • Confirming a PIN
  • Checking subscription status

Note: For security reasons, the actual domain of the APIs and the username and password required for basic authentication will be provided separately.

Authentication ​

All requests require basic authentication using the Authorization header with a base64 encoded username and password.

Endpoints ​

Generate PIN ​

Endpoint: POST /api/generate-pin

Description: This endpoint generates a PIN for a given product ID and MSISDN.

Request:

bash
curl --request POST \
  --url https://domain.com/api/generate-pin \
  --header 'Accept: application/json' \
  --header 'Accept-Language: en' \
  --header 'Authorization: Basic YWRtaW46MTIzNDU2' \
  --header 'Content-Type: application/json' \
  --data '{
    "product_id": 971000000,
    "msisdn": 971123456789,
    "selector": "#btn-submit"
}'

Headers:

  • Accept: application/json
  • Accept-Language: en
  • Authorization: Basic YWRtaW46MTIzNDU2
  • Content-Type: application/json

Body Parameters:

  • product_id (integer): The ID of the product.
  • msisdn (integer): The mobile subscriber integrated services digital network number.
  • selector (string): The css selector for the submit button in the OTP page - nullable.

Note: For UAE services, selector parameter is required, you should pass the css selector for the call-to-action button (submit button) in the confirm OTP page.

Response Example:

The API response will be in JSON format. Below is an example of a successful response:

Note: For UAE services, in success response an extra parameter returned called script contains securety script you should place it between <script></script> tag in confirm OTP page to make the subscription completed successfully.

Success Response:

Normal Response:

json
{
  "responseMessage": "OTP sent successfully",
  "status": true,
  "responseCode": 1005,
  "data": {}
}

UAE Response:

json
{
  "responseMessage": "OTP sent successfully",
  "status": true,
  "responseCode": 1005,
  "data": {
    "script": "JAVASCRIPT_CODE_SHOULD_BE_PLACED_IN_CONFIRM_PIN_PAGE"
  }
}

OR

json
{
  "responseMessage": "Already Subscribed!",
  "status": true,
  "responseCode": 1011,
  "data": {
    "redirect_url": "THE_CONTENT_PORTAL_HERE"
  }
}

Error Response:

If there is an error with the request, the response will include an error message. Example:

json
{
  "responseMessage": "Failed to initialize subscription",
  "status": false,
  "responseCode": 0
}

Response Codes:

For better translation use the responseCode value beside the response status.

  • 200 OK: Request completed successfully.
    • 1005: OTP sent successfully
    • 1011: Already subscribed!
    • 1010: Subscribed successfully!
  • 401 Unauthorized: Authentication failed.
  • 422 Validation errors: Validation errors
  • 500 Internal Server Error: Failed to initialize subscription
    • -1005: Invalid phone number

Confirm PIN ​

Endpoint: POST /api/confirm-pin

Description: This endpoint confirms a previously generated PIN for a given product ID, MSISDN, and OTP (One-Time Password).

Request:

bash
curl --request POST \
  --url https://domain.com/api/confirm-pin \
  --header 'Accept: application/json' \
  --header 'Accept-Language: en' \
  --header 'Authorization: Basic YWRtaW46MTIzNDU2' \
  --header 'Content-Type: application/json' \
  --data '{
    "product_id": 971000000,
    "msisdn": 971123456789,
    "otp": "5214"
}'

Headers:

  • Accept: application/json
  • Accept-Language: en
  • Authorization: Basic YWRtaW46MTIzNDU2
  • Content-Type: application/json

Body Parameters:

  • product_id (integer): The ID of the product.
  • msisdn (integer): The mobile subscriber integrated services digital network number.
  • otp (string): The one-time password received by the user.

Response Example:

The API response will be in JSON format. Below is an example of a successful response:

Success Response:

json
{
  "responseMessage": "Subscribed Successfully!",
  "status": true,
  "responseCode": 1010,
  "data": {
    "redirect_url": "THE_CONTENT_PORTAL_HERE"
  }
}

Error Response:

If there is an error with the request, the response will include an error message. Example:

json
{
  "responseMessage": "Failed to confirm subscription",
  "status": false,
  "responseCode": 0
}

Response Codes:

For better translation use the responseCode value beside the response status.

  • 200 OK: Request completed successfully.
    • 1010: Subscribed successfully!
    • 1011: Already subscribed!
  • 401 Unauthorized: Authentication failed.
  • 422 Validation errors: Validation errors
  • 500 Internal Server Error:
    • -1001: Invalid PIN. Please try again.
    • -1002: Something error please try again.
    • -1003: Sorry, you do not have enough balance to subscribe. Please recharge your account and try again.
    • -1004: OTP expired. Please request a new OTP.

Check Subscription ​

Endpoint: POST /api/check-subscription

Description: This endpoint checks the subscription status for a given product ID and MSISDN.

Request:

bash
curl --request POST \
  --url https://domain.com/api/check-subscription \
  --header 'Accept: application/json' \
  --header 'Accept-Language: en' \
  --header 'Authorization: Basic YWRtaW46MTIzNDU2' \
  --header 'Content-Type: application/json' \
  --data '{
    "product_id": 971000000,
    "msisdn": 971123456789
}'

Headers:

  • Accept: application/json
  • Accept-Language: en
  • Authorization: Basic YWRtaW46MTIzNDU2
  • Content-Type: application/json

Body Parameters:

  • product_id (integer): The ID of the product.
  • msisdn (integer): The mobile subscriber integrated services digital network number.

Response Example:

The API response will be in JSON format. Below is an example of a successful response:

Success Response:

json
{
  "responseMessage": "The subscriber is active.",
  "status": true,
  "responseCode": 1,
  "data": {
    "endSubDate": "yyyy-MM-dd HH:mm:ss"
  }
}

Error Response:

If there is an error with the request, the response will include an error message. Example:

json
{
  "responseMessage": "This subscriber is not active.",
  "status": false,
  "responseCode": 0
}

Response Codes:

For better translation use the responseCode value beside the response status.

  • 200 OK: The subscriber is active.
  • 401 Unauthorized: Authentication failed.
  • 422 Validation errors: Validation errors
  • 403 Not Active: This subscriber is not active.
  • 404 Not Found: This subscriber is not subscribed to this product.

Cancel Subscription ​

Endpoint: POST /api/cancel-subscription

Description: This endpoint cancel the subscription for a given product ID and MSISDN.

Request:

bash
curl --request POST \
  --url https://domain.com/api/cancel-subscription \
  --header 'Accept: application/json' \
  --header 'Accept-Language: en' \
  --header 'Authorization: Basic YWRtaW46MTIzNDU2' \
  --header 'Content-Type: application/json' \
  --data '{
    "product_id": 971000000,
    "msisdn": 971123456789
}'

Headers:

  • Accept: application/json
  • Accept-Language: en
  • Authorization: Basic YWRtaW46MTIzNDU2
  • Content-Type: application/json

Body Parameters:

  • product_id (integer): The ID of the product.
  • msisdn (integer): The mobile subscriber integrated services digital network number.

Response Example:

The API response will be in JSON format. Below is an example of a successful response:

Success Response:

json
{
  "responseMessage": "You are unsubscribed successfully",
  "status": true,
  "responseCode": 1
}

Error Response:

If there is an error with the request, the response will include an error message. Example:

json
{
  "responseMessage": "This subscriber is not subscribed to this product.",
  "status": false,
  "responseCode": 0
}

Response Codes:

For better translation use the responseCode value beside the response status.

  • 200 OK: Unsubscribe successfully.
  • 401 Unauthorized: Authentication failed.
  • 422 Validation errors: Validation errors
  • 500 Server Error: Failed to unsubscribe the subscriber

Notes ​

  • Ensure that all requests has Accept-Language in headers to enable translation of the labels.
  • Available languages are: Arabic: ar, English: en, and Amharic am.
  • Ensure that all header values are correct and that the Authorization header contains a valid base64 encoded username and password.
  • The msisdn should be in the correct format and associated with the product ID provided.