Change language settings to use Topvisor in your preferred language. You can select and set a preferred language later in the Account settings. Change language settings to use Topvisor in your preferred language. ru Русский Apply

First API call

Find more details about API on the Getting started with API page.
Find more details about API SDK on the Topvisor SDK: PHP page.
Find more details about selection parameters on the basic request parameters page.

In the below example we'll retrieve the last 10 operations from the billing log.

Request

  • operator: get
  • service name: bank_2
  • method name: history

  • Constructor

  • 			POST /v2/json/get/bank_2/history HTTP/1.1
    Host: api.topvisor.com
    Content-Type: application/json User-Id: %USER_ID% Authorization: bearer %USER_API_KEY% {"fields":["date","info","sum"],"orders":[{"name":"date","direction":"DESC"}],"limit":"10"}
    			curl 
    			-H 'Content-Type: application/json' 
    			-H 'User-Id: %USER_ID%' 
    			-H 'Authorization: bearer %USER_API_KEY%' 
    			-d '{"fields":["date","info","sum"],"orders":[{"name":"date","direction":"DESC"}],"limit":"10"}' 
    			"https://api.topvisor.com/v2/json/get/bank_2/history"
    			
    			<?php
    
    			use TopvisorSDKV2 as TV;
    
    			// replace "..." with a path to the autoload.php file if you use composer
    			include(__DIR__.'/../../autoload.php');
    
    			// write a path to SDK Topvisor, if you don't use composer
    			//include_once('topvisor-sdk/src/V2/Fields.php');
    			//include_once('topvisor-sdk/src/V2/Page.php');
    			//include_once('topvisor-sdk/src/V2/Pen.php');
    			//include_once('topvisor-sdk/src/V2/Session.php');
    
    			// $accessToken is equal to API key
    			$TVSession = new TVSession(['userId' => $userId, 'accessToken' => $accessToken]);
    
    			$selectorBankHistory = new TVPen($TVSession, 'get', 'bank_2', 'history');
    			$selectorBankHistory->setFields(['date','info', 'sum']);
    			$selectorBankHistory->setOrders([
    				TVFields::genOrderData('date', 'DESC')
    			]);
    			$selectorBankHistory->setLimit(10);
    
    			$page = $selectorBankHistory->exec();
    
    			// catch error
    			if(is_null($page->getResult())){
    				var_dump($page->getErrors());
    			return;
    			}
    
    			// is array of bank history
    			var_dump($page->getResult());
    			

    Response

    			{"result":[{"date":"2022-05-10 11:40:47","info":"Keyword rank check for #NN","sum":"-0.75"},{"date":"2022-05-11 11:40:47","info":"Keyword rank check for #NN","sum":"-0.71"},{"date":"2022-05-14 11:40:47","info":"Keyword rank check for #NN","sum":"-0.6"},{"date":"2022-05-10 11:40:47","info":"Keyword rank check for #NN","sum":"-0.59"},{"date":"2022-05-06 11:40:47","info":"Keyword rank check for #NN","sum":"-0.36"},{"date":"2022-05-12 11:40:47","info":"Keyword rank check for #NN","sum":"-0.23"},{"date":"2022-05-16 11:40:47","info":"Keyword rank check for #NN","sum":"-0.98"},{"date":"2022-05-11 11:40:47","info":"Keyword rank check for #NN","sum":"-0.16"},{"date":"2022-05-06 11:40:47","info":"Keyword rank check for #NN","sum":"-0.97"},{"date":"2022-05-14 11:40:47","info":"Keyword rank check for #NN","sum":"-0.59"}],"limitedBy":10,"total":100}