-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Struggling to get Admin Logs #77
Comments
What files are you trying to get? |
I have sorted this issue now however I cannot retrive the list of
players via the API endpoint
Im still waiting on a response for this
…On 2022-03-22 11:57, Timo wrote:
What files are you trying to get?
Which game is affected?
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#77 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/AVIT6YTZ3JRGDCYCQ7ERVWLVBGYTNANCNFSM5OO4PFSA
--
Regards
Chris Yates
M : 07763 399009
|
Hi Timo,
Apologies I thought you were from Nitrado support
I had issues actually using the NitrAPI package
The example call works and returns the server info
however I cant quite figure out how to call other functions like
getBanlist etc
Can you provide me with an example as I usually use cURL
Thanks
…On 2022-03-22 11:57, Timo wrote:
What files are you trying to get?
Which game is affected?
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#77 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/AVIT6YTZ3JRGDCYCQ7ERVWLVBGYTNANCNFSM5OO4PFSA
--
Regards
Chris Yates
M : 07763 399009
|
Sure. Please check if that helps. <?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../token.php';
$searchedId = 10724662;
try {
$api = new \Nitrapi\Nitrapi(ACCESS_TOKEN);
foreach ($api->getServices() as $service) {
if (!$service instanceof Nitrapi\Services\Gameservers\Gameserver) {
continue;
}
if ($service->getId() == $searchedId) {
$banlist = new Nitrapi\Services\Gameservers\Banlist($service);
var_dump($banlist->getBanlist());
break;
}
}
} catch(\Exception $e) {
var_dump("API Error: " . $e->getMessage());
} |
Brill cheers,
will check later on and get back to you ..
I'm more procedural than OOP so always get a bit messed when trying to
use classes etc
Will pop an email later if you're sure you dont mind :)
Regards
Chris
…On 2022-03-23 08:01, Timo wrote:
Sure. Please check if that helps.
<?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../token.php';
$searchedId = 10724662;
try {
$api = new \Nitrapi\Nitrapi(ACCESS_TOKEN);
foreach ($api->getServices() as $service) {
if (!$service instanceof
Nitrapi\Services\Gameservers\Gameserver) {
continue;
}
if ($service->getId() == $searchedId) {
$banlist = new
Nitrapi\Services\Gameservers\Banlist($service);
var_dump($banlist->getBanlist());
break;
}
}
} catch(\Exception $e) {
var_dump("API Error: " . $e->getMessage());
}
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#77 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/AVIT6YTOPOKI2CLIMORT5BLVBLFVJANCNFSM5OO4PFSA
--
Regards
Chris Yates
M : 07763 399009
|
Hi Timo,
Ok quickly tried it and just like when I use their REST Api
I get this error
API Error: Internal error. If this error persists for more than 15
minutes, please contact our support and include this error ID:
"2dc99ce353a9492cb07d401cf29c5e5c"'
Don't know why ...
Yet if I just check the Gameserver Details it has the banlist in an
array
I've been trying to add a players Gamer Tag to the banlist with the REST
Api using the
https://api.nitrado.net/services/:id/gameservers/games/banlist
endpoint but again I still get the error
The game on the server is DayZ
Yet it shouldnt make any difference regarding the game
Another option I have, if its possible..
Is to somehow export the current settings as a json file
as that contains the banlist / whitelist etc,
edit the file with a bit of code
and then somehow upload the new settings file
I'm just surprised at how rubbish Nitrado support are regarding the API
..
None of their team seem to know how it works and keep refetring you to
post in the Forum ( which is useless )
So I really do appreciate all the help you are giving
…On 2022-03-23 08:01, Timo wrote:
Sure. Please check if that helps.
<?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../token.php';
$searchedId = 10724662;
try {
$api = new \Nitrapi\Nitrapi(ACCESS_TOKEN);
foreach ($api->getServices() as $service) {
if (!$service instanceof
Nitrapi\Services\Gameservers\Gameserver) {
continue;
}
if ($service->getId() == $searchedId) {
$banlist = new
Nitrapi\Services\Gameservers\Banlist($service);
var_dump($banlist->getBanlist());
break;
}
}
} catch(\Exception $e) {
var_dump("API Error: " . $e->getMessage());
}
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#77 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/AVIT6YTOPOKI2CLIMORT5BLVBLFVJANCNFSM5OO4PFSA
--
Regards
Chris Yates
M : 07763 399009
|
Hi Timo
Sorry for yet another email ..
Ok so Ive managed to download the ban.txt file and edit but I cant
upload as it seems it wont overwrite teh existing file
I also based on your example I have tried
$identifier = 'GAMERTAG'
$banlist->addBnlist($indentifier);
Yet I still get Nitrado's annoying error
API Error: Internal error. If this error persists for more than 15
minutes, please contact our support and include this error ID:
"f849325c76444f3d85cf3ab137ca6a28
Which none of the support staff seem to have a clue what that represents
…On 2022-03-23 10:44, Chris Yates wrote:
Hi Timo,
Ok quickly tried it and just like when I use their REST Api
I get this error
API Error: Internal error. If this error persists for more than 15
minutes, please contact our support and include this error ID:
"2dc99ce353a9492cb07d401cf29c5e5c"'
Don't know why ...
Yet if I just check the Gameserver Details it has the banlist in an
array
I've been trying to add a players Gamer Tag to the banlist with the
REST Api using the
https://api.nitrado.net/services/:id/gameservers/games/banlist
endpoint but again I still get the error
The game on the server is DayZ
Yet it shouldnt make any difference regarding the game
Another option I have, if its possible..
Is to somehow export the current settings as a json file
as that contains the banlist / whitelist etc,
edit the file with a bit of code
and then somehow upload the new settings file
I'm just surprised at how rubbish Nitrado support are regarding the API
..
None of their team seem to know how it works and keep refetring you to
post in the Forum ( which is useless )
So I really do appreciate all the help you are giving
On 2022-03-23 08:01, Timo wrote:
> Sure. Please check if that helps.
>
> <?php
>
> require_once __DIR__ . '/../vendor/autoload.php';
> require_once __DIR__ . '/../token.php';
>
> $searchedId = 10724662;
>
> try {
> $api = new \Nitrapi\Nitrapi(ACCESS_TOKEN);
>
> foreach ($api->getServices() as $service) {
> if (!$service instanceof
> Nitrapi\Services\Gameservers\Gameserver) {
> continue;
> }
>
> if ($service->getId() == $searchedId) {
> $banlist = new
> Nitrapi\Services\Gameservers\Banlist($service);
> var_dump($banlist->getBanlist());
> break;
> }
> }
>
> } catch(\Exception $e) {
> var_dump("API Error: " . $e->getMessage());
> }
>
> --
> Reply to this email directly, view it on GitHub [1], or unsubscribe
> [2].
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
> Links:
> ------
> [1]
> #77 (comment)
> [2]
> https://github.com/notifications/unsubscribe-auth/AVIT6YTOPOKI2CLIMORT5BLVBLFVJANCNFSM5OO4PFSA
--
Regards
Chris Yates
M : 07763 399009
|
the errors 2dc99ce353a9492cb07d401cf29c5e5c + f849325c76444f3d85cf3ab137ca6a28 mean "banlist not available for this game". DayZ seems to be one of those games which have a banlist which is not implemented in the Nitrapi management. If you use DayZ for PC then you are looking for the "files" feature.
Here an example <?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../token.php';
try {
$api = new \Nitrapi\Nitrapi(ACCESS_TOKEN);
foreach ($api->getServices() as $service) {
if (!$service instanceof Nitrapi\Services\Gameservers\Gameserver) {
continue;
}
if ($service->getId() == $serviceId) {
$fs = new \Nitrapi\Services\Gameservers\FileServer\FileServer($service);
var_dump($fs->getFileList('/games/' . $cid . '/ftproot/dayzstandalone'));
var_dump($fs->downloadToken('/games/' . $cid . '/ftproot/dayzstandalone/ban.txt'));
break;
}
}
} catch(\Exception $e) {
var_dump("API Error: " . $e->getMessage());
} |
Yeah managed to download the ban file and edit ..
just cant get it uploading
…On 2022-03-23 15:21, Timo wrote:
the errors 2dc99ce353a9492cb07d401cf29c5e5c +
f849325c76444f3d85cf3ab137ca6a28 mean "banlist not available for this
game".
This comes because of the different implementations of "banlist"
within the games itself.
DayZ seems to be one of those games which have a banlist which is not
implemented in the Nitrapi management.
If you even use DayZ on a console platform (like XBox) then file
uploads (directly into the gameserver) are difficult.
So the "banlist" feature is not applicable for your requirements.
If you use DayZ for PC then you are looking for the "files" feature.
https://webinterface.nitrado.net/$yourServiceIdHere/wi/filebrowser/edit?filepath=dayzstandalone%2Fban.txt
Here an example
<?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../token.php';
try {
$api = new \Nitrapi\Nitrapi(ACCESS_TOKEN);
foreach ($api->getServices() as $service) {
if (!$service instanceof
Nitrapi\Services\Gameservers\Gameserver) {
continue;
}
if ($service->getId() == $serviceId) {
$fs = new
\Nitrapi\Services\Gameservers\FileServer\FileServer($service);
var_dump($fs->getFileList('/games/' . $cid .
'/ftproot/dayzstandalone'));
var_dump($fs->downloadToken('/games/' . $cid .
'/ftproot/dayzstandalone/ban.txt'));
break;
}
}
} catch(\Exception $e) {
var_dump("API Error: " . $e->getMessage());
}
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#77 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/AVIT6YWXLBQ5AMQNEP6NAADVBMZG7ANCNFSM5OO4PFSA
--
Regards
Chris Yates
M : 07763 399009
|
"is not working" is not a very good error description ;) Any error message? This works for me var_dump($fs->uploadFile('/_tmp/ban.txt', '/games/' . $cid . '/ftproot/dayzstandalone/', 'ban.txt', )); |
Yeaj I know,
sadly Im not having any error messages
Also with your example below the ban.txt sits inside the
/games/ID/noftp/dayzxb/ path
but again because its console it wont pick it up
Dont know why there is issues with the Nitrado servers for console games
…On 2022-03-23 15:46, Timo wrote:
"is not working" is not a very good error description ;)
Any error message?
This works for me
var_dump($fs->uploadFile('/_tmp/ban.txt', '/games/' . $cid .
'/ftproot/dayzstandalone/', 'ban.txt', ));
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#77 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/AVIT6YR4M3V22UJVYMYFAQLVBM4FTANCNFSM5OO4PFSA
--
Regards
Chris Yates
M : 07763 399009
|
Now getting this error
Uncaught TypeError: Argument 3 passed to GuzzleHttp\Client::request()
must be of the type array, string given, called in
C:\Users\owner\vendor\guzzlehttp\guzzle\src\Client.php on line 95 and
defined in C:\Users\owner\vendor\guzzlehttp\guzzle\src\Client.php on
line 179
Here is the code I'm using
$path = '/games/ID/ftproot/dayzxb';
$file = 'ban.txt';
var_dump($api->uploadFile('ban.txt','/games/ID/ftproot/dayzxb/','ban.txt'));
…On 2022-03-23 15:46, Timo wrote:
"is not working" is not a very good error description ;)
Any error message?
This works for me
var_dump($fs->uploadFile('/_tmp/ban.txt', '/games/' . $cid .
'/ftproot/dayzstandalone/', 'ban.txt', ));
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#77 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/AVIT6YR4M3V22UJVYMYFAQLVBM4FTANCNFSM5OO4PFSA
--
Regards
Chris Yates
M : 07763 399009
|
My code works and I can see the changes in the Webinterface. var_dump($fs->downloadToken('/games/' . $cid . '/noftp/dayzxb/ban.txt'));
var_dump($fs->uploadFile('/_tmp/ban.txt', '/games/' . $cid . '/noftp/dayzxb/', 'ban.txt', )); |
Can you confirm I've done this right ?
$serverID = '10107939';
try {
$api = new \Nitrapi\Nitrapi("ACCESS TOKEN");
echo "<pre>";
print_r($api->getServices());
echo "</pre>";
foreach ($api->getServices() as $service) {
if (!$service instanceof
Nitrapi\Services\Gameservers\Gameserver) {
continue;
}
if ($service->getId() == $serverID) {
$path = '/games/'.$serverID.'/ftproot/dayzxb';
$file = 'ban.txt';
var_dump($api->uploadFile('ban.txt','/games/'.$serverID.'/ftproot/dayzxb/','ban.txt'));
break;
}
}
} catch(\Exception $e) {
var_dump("API Error: " . $e->getMessage());
}
Really appreciate all of your help
…On 2022-03-23 16:16, Timo wrote:
My code works and I can see the changes in the Webinterface.
Maybe a server restart is needed for you.
var_dump($fs->downloadToken('/games/' . $cid .
'/noftp/dayzxb/ban.txt'));
var_dump($fs->uploadFile('/_tmp/ban.txt', '/games/' . $cid .
'/noftp/dayzxb/', 'ban.txt', ));
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#77 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/AVIT6YX6G5ZNA5LB344BI23VBM7VHANCNFSM5OO4PFSA
--
Regards
Chris Yates
M : 07763 399009
|
I have also tried this using normal cURL
Have got the upload token & the URL in the response
When I then try to upload the file with the token, is the URL i call
with cURL
the url that I get given ( like this
https://fileserver.nitrado.net/usla910/upload
with the token or is it still the
endpoint :
https://api.nitrado.net/services/10107939/gameservers/file_server/upload
…On 2022-03-23 16:16, Timo wrote:
My code works and I can see the changes in the Webinterface.
Maybe a server restart is needed for you.
var_dump($fs->downloadToken('/games/' . $cid .
'/noftp/dayzxb/ban.txt'));
var_dump($fs->uploadFile('/_tmp/ban.txt', '/games/' . $cid .
'/noftp/dayzxb/', 'ban.txt', ));
--
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
You are receiving this because you authored the thread.Message ID:
***@***.***>
Links:
------
[1]
#77 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/AVIT6YX6G5ZNA5LB344BI23VBM7VHANCNFSM5OO4PFSA
--
Regards
Chris Yates
M : 07763 399009
|
DayZ XB special case ;) Please try this $bans = $service->getCustomerSettings()->readSetting('general', 'bans');
var_dump($bans);
$service->getCustomerSettings()->writeSetting('general', 'bans', $bans . PHP_EOL . 'newusername'); |
@ChrisYatesUK did it work? |
Hi Timo
Hope you're well...
Just got a quick question,
Using $api->getServices()
Why am I unable to pull the player_count value ?
Is it because info is protected ..
Array
(
[0] => Nitrapi\Services\Gameservers\Gameserver Object
(
[game:protected] =>
[info:protected] => Array
The value Im trying to pull is
[0][info][gameserver][query][player_count]
Keep getting Cannot use object of type
Nitrapi\Services\Gameservers\Gameserver as array
It does display it along with all the other data when I dump the
getServices() function as you can see from here..
[query] => Array
(
[server_name] => DayZ Of Survival -
PvP / PvE - Lightly Modded - Custom POI's - Traders & Events
[connect_ip] => 95.156.250.43:10800
[map] => dayzOffline.chernarusplus
[version] => v1.17.154754
[player_current] => 1
[player_max] => 32
[players] => Array
(
)
)
Any ideas ?
Thanks in advance
Chris
…On 2022-03-30 13:42, Timo wrote:
@ChrisYatesUK [1] did it work?
--
Reply to this email directly, view it on GitHub [2], or unsubscribe
[3].
You are receiving this because you were mentioned.Message ID:
***@***.***>
Links:
------
[1] https://github.com/ChrisYatesUK
[2]
#77 (comment)
[3]
https://github.com/notifications/unsubscribe-auth/AVIT6YT2IDXNT44VIUA33I3VCRD2PANCNFSM5OO4PFSA
--
Regards
Chris Yates
M : 07763 399009
|
Hey Chris Please try this <?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../token.php';
try {
$api = new \Nitrapi\Nitrapi(ACCESS_TOKEN);
/* @var $service Nitrapi\Services\Gameservers\Gameserver */
$service = $api->getService(['id' => $serviceId]);
$playerData = $service->getDetails()->getQuery();
echo $playerData['player_current'], ' of ', $playerData['player_max'], ' are online' . PHP_EOL;
} catch (\Exception $e) {
var_dump("API Error: " . $e->getMessage());
} 'Closing this thread since it the base issue is solved and it is getting more-and-more into a support thread ;) |
Hi Guys..
I cant seem to access the ADM files ...
Can anyone please provide some sample code as its only this that i now preventing me from putting this app live
Thanks
The text was updated successfully, but these errors were encountered: