API FUP For a Tariff

fup
api

#1

As per your admin frontend you can set the FUP per tariff. I would like to know how to do the same for a tariff using your API.


#2

Hi,
you can use this script to set FUP Policy for current FUP id


#!/usr/bin/php
<?php

include './SplynxApi.php'; // API source

$api_url = 'http://XXX.XXX.XXX.XXX/'; // please set your Splynx URL
$key = "XXXXXXXXXXXXXXXXXXXXXXXXXX"; // please set your key
$secret = "XXXXXXXXXXXXXXXXXXXXXXXXXX"; // please set your secret
$api = new SplynxAPI($api_url, $key, $secret);

$ApiUrlFup = "admin/fup/policies";

	$id_fup = 10;         // set FUP-id
	$speed = 98;         // set FUP-speed 
        $fup = 5;                // set FUP-traffic
	$conditions =  '[ {	"type": "monthly", "direction": "updown", "amount": '.$fup.', "unit": "gb" }  ]'; 
// where type - FUP-type, direction - FUP-direction and unit

	$params_fup = [
      	      	'name' => 'month',        // FUP-param name 
		'percent' => "$speed",
		'conditions' => "$conditions"				
      	      
      	];
	
	$result = $api->api_call_put($ApiUrlFup, $id_fup, $params_fup);

?>

WBR, Splynx team