<?php // Configuration $api_url = 'http://127.0.0.1/cake4/rd_cake/vouchers/add.json'; $token = 'fe707444-b00c-b00c-b00c-03ae7fc12345'; $cloud_id = 23; // replace with the Cloud ID that you want to work on. $realm = 'pppoe'; $profile = 'slow'; // Set API payload $payload = [ //Required Fields 'single_field' => 'true', //must be set to the string 'true' to be activated 'realm' => $realm, 'profile' => $profile, 'cloud_id' => $cloud_id, 'token' => $token, //To create a batch these are needed (leave out for single voucher creation) 'quantity' => 10, 'batch' => 'api_batch_one' ]; $json_payload = json_encode($payload); $ch = curl_init($api_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $json_payload); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $response = curl_exec($ch); curl_close($ch); echo "Added single voucher: $response\n"; ?>