The Send_Push method is used to send a push notification to a specified recipient.

The required parameters are the recipient through the parameter to that corresponds to the ID of the token on which you want to send the push, that you can find in the User Data in WebADM GUI. It is in the form PlatformId:PushId. The other parameter is application which is the RCDevs' target mobile app name.
You can also specify the dictionnaries options and data for the push notification but also its timeout.

This method returns true on succes and false on error.


import requests
import json

# Define the method and parameters
method = 'Send_Push'
params = {
    'application': 'token',
    'to': 'AND:cwIQh6j074PQviuP--9tCm:APA91bG1N1_s5N5',
    'options': {
      'title': 'Test',
      'body': 'Received from OpenOTP',
      'vibrate': 1,
      'category': 'auth'
    },
    'data': {
      'session': 'GN8edu7CD0LAayVx',
      'category': 'auth',
      'language': 'DE',
      'challenge': 'b1f2bbf715f20290dacb30f0990eec45aed5d9b0',
      'timestamp': '67d3f640',
      'signature': 'c0c1d4c6c0ab743923731464553afa8c41360fc3',
      'client': '560537702ebb33204ed726860c0d5efe',
      'timeout': 90
    },
    'timeout': '30'
}

# Create the request payload
request_payload = {
    'jsonrpc': "2.0",
    'method': method,
    'params': params,
    'id': 0
}

# Convert payload to JSON
json_payload = json.dumps(request_payload)

# Define the URL and credentials
url = "https://webadm1.rcdevsdocs.com/manag/"
auth = ("RCDEVSDOCS\\administrator", "password")

# Define the headers
headers = {
    "Content-Type": "application/json",
    "Connection": "close"
}

# Make the POST request
response = requests.post(url, data=json_payload, headers=headers, auth=auth, verify=False)

# Print the HTTP response code and response content
print(f"HTTP response code: {response.status_code}")
print(response.json())
    

<?php
#!/bin/php
$method = 'Send_Push';
$params = array(
    'application' => 'token',
    'to' => 'AND:cwIQh6j074PQviuP--9tCm:APA91bG1N1_s5N5',
    'options'=> [
      'title' => 'Test',
      'body' => 'Received from OpenOTP',
      'vibrate' => 1,
      'category' => 'auth'
    ],
    'data' => [
      'session' => 'GN8edu7CD0LAayVx',
      'category' => 'auth',
      'language' => 'DE',
      'challenge' => 'b1f2bbf715f20290dacb30f0990eec45aed5d9b0',
      'timestamp' => '67d3f640',
      'signature' => 'c0c1d4c6c0ab743923731464553afa8c41360fc3',
      'client' => '560537702ebb33204ed726860c0d5efe',
      'timeout' => 90
    ],
    'timeout' => '30'
);

$request = array(
    'jsonrpc' => "2.0",
    'method' => $method,
    'params' => $params,
    'id' => 0
);
$json = json_encode($request);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://webadm1.rcdevsdocs.com/manag/");
curl_setopt($ch, CURLOPT_USERPWD, "RCDEVSDOCS\\administrator:password");
curl_setopt($ch, CURLOPT_HTTPHEADER, array("connection: close"));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
$out = curl_exec($ch);
curl_close($ch);

print_r(json_decode($out));
?>
    

# Define the method and parameters
$method = 'Send_Push'
$params = @{
    application = 'token'
    to = 'AND:cwIQh6j074PQviuP--9tCm:APA91bG1N1_s5N5'
    options = @{
      title = 'Test'
      body = 'Received from OpenOTP'
      vibrate = 1
      category = 'auth'
    }
    data = @{
      session = 'GN8edu7CD0LAayVx'
      category = 'auth'
      language = 'DE'
      challenge = 'b1f2bbf715f20290dacb30f0990eec45aed5d9b0'
      timestamp = '67d3f640'
      signature = 'c0c1d4c6c0ab743923731464553afa8c41360fc3'
      client = '560537702ebb33204ed726860c0d5efe'
      timeout = 90
    }
    timeout = '30'
}

# Create the request payload
$requestPayload = @{
    'jsonrpc' = '2.0'
    'method' = $method
    'params' = $params
    'id' = 0
}

# Convert the request payload to JSON
$jsonPayload = $requestPayload | ConvertTo-Json

# Define the URL and credentials
$url = "https://webadm1.rcdevsdocs.com/manag/"
$auth = "RCDEVSDOCS\administrator:password"

# Make the POST request
$response = Invoke-RestMethod -Uri $url -Method Post -Body $jsonPayload -Headers @{ "Content-Type" = "application/json" } -Credential (New-Object System.Management.Automation.PSCredential($auth, (ConvertTo-SecureString "password" -AsPlainText -Force))) -SkipCertificateCheck

# Output the response
Write-Host "HTTP Response Code: $($response.status_code)"
Write-Host $response | ConvertTo-Json