Getting Your API Key
To use the liteit.app REST API, you need an API key. Follow these steps to generate one:- Sign in to your liteit.app dashboard.
- Navigate to Account API Keys.
- Click Create New Key to generate an API key for your project.
Important Notes:
- Each account is limited to one API key.
- Generating a new API key deletes the old one and replaces it with the new key.
- Copy your API key immediately, as it will not be displayed again.
- Once you have your API key, you can use it to authenticate API requests.
Send Push Notification
To send a push notification via the liteit.app REST API, make a POST request to the API endpoint with the required data. Send a POST request with a JSON payload containing:Request Format
- key – Your unique API key.
- userid – Your account ID.
- appid – The target app ID.
- title – The notification title.
- body – The message content.
<?php
$endpoint = 'https://api.liteit.app/push/send.html';
$data = [
'key' => 'xxxxxxxxxxxx', //Your API key
'userid' => $user_id,
'appid' => $web_app,
'title' => $title,
'body' => $msg
];
$json_data = json_encode($data);
$ch = curl_init($endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Content-Length: ' . strlen($json_data)
]);
$response = curl_exec($ch);
curl_close($ch);
?>