URL: /api/dataapi
Methods: POST
, GET
This API endpoint allows users to purchase mobile data for mobile phones and other internet enabled devices.
To access this endpoint, users must include their API key and secret key in the request headers.
See usage example in the code snippets below:
POST request to purchase data:
Content-Type: application/json api-key: your-api-key secret-key: your-secret-key { "phone": "08032566178", "firstLevel": "MTN SME", "secondLevel": "1GB" }
Response:
- Status Code: 200 { "message": "Transaction successful", "dataHistory": { "transactionId": "1234567890", "email": "user@example.com", "activity": "MTN SME", "message": "1GB", "status": "Success", "recipient": "08032566178", "amount": 240, "initialBalance": 500, "finalBalance": 260, "Method": API, } }
{ "error": "Transaction failed", "dataHistory": { "transactionId": "1234567890", "email": "user@example.com", "activity": "MTN SME", "message": "1GB", "status": "Failed", "recipient": "08032566178", "amount": 240, "initialBalance": 500, "finalBalance": 500 "Method": API, } }
See usage example in the code snippets below:
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 "MTN SME": { "available": true, "secondLevel": [ "500MB", "1GB", "2GB", "3GB" ], "amount": [ 120, 240, 480, 720 ] }, "MTN CG": { "available": true, "secondLevel": [ "500MB", "1GB", "2GB", "3GB", "5GB", "10GB" ], "amount": [ 130, 275, 565, 855, 1435, 2885 ] } }