Cable Subscription Endpoint

Endpoint

URL: /api/cableapi

Methods: POST, GET

Description

This API endpoint allows users to purchase cable Tv Subscription.

Authentication

To access this endpoint, users must include their API key and secret key in the request headers.

Request Headers

  • api-key (string, required): The API key of the user.
  • secret-key (string, required): The secret key of the user.

Request Body (POST)

  • number (string, required): The smart card number to subscribe on.
  • firstLevel (string, required): The name of the subscription.
  • secondLevel (string, required): The subscription package.

Usage Example

See usage example in the code snippets below:

Example: Purchase Tv Subscription

POST request to purchase tv subscription:


Content-Type: application/json
api-key: your-api-key
secret-key: your-secret-key

{
"number": "0000000000",
"firstLevel": "DSTV",
"secondLevel": "dstv padi"
}
      

Response:


- Status Code: 200

{
"message": "Transaction successful",
"cableHistory": {
"transactionId": "1234567890",
"email": "user@example.com",
"activity": "DSTV",
"message": "dstv padi",
"status": "Success",
"recipient": "0000000000",
"amount": 2950,
"initialBalance": 3000,
"finalBalance": 50,
"Method": API,
}
}
      

Failed Response Format



{
"error": "Transaction failed",
"cableHistory": {
"transactionId": "0000000000",
"email": "user@example.com",
"activity": "DSTV",
"message": "dstv padi",
"status": "Failed",
"recipient": "0000000000",
"amount": 2950,
"initialBalance": 3000,
"finalBalance": 3000
"Method": API,
}
}
    

GET request

See usage example in the code snippets below:

Get the list of available firstLevel and secondLevel

GET request for available firstLevel and secondLevel:


Content-Type: application/json
api-key: your-api-key
secret-key: your-secret-key

      

Response:


- Status Code: 200

{
    "DSTV": {
        "available": true,
        "secondLevel": [
            "dstv padi"
        ],
        "amount": [
            2950
        ]
    }
}
            

Other Error Responses

  • 401 Unauthorized: Invalid API key or secret key.
  • 404 Not Found: User not found or data not available.
  • 500 Internal Server Error: Internal server error occurred.