Using ManiaHome Methods

Maniaplanet public API, ManiaConnect system and the open source PHP SDK.

Moderator: NADEO

User avatar
fastforza
Posts: 859
Joined: 15 Jun 2010, 11:19
Contact:

Re: Using ManiaHome Methods

Post by fastforza »

Oops ... I was using the password from one of my other API users. :oops: Although now I'm getting 400 bad request response statuses. :?
Last edited by fastforza on 27 Oct 2011, 12:11, edited 2 times in total.
Mania Exchange - Share your maps!

ASUS Maximus IV GENE Z / i7 2600K 3.40Ghz QC / 16GB G.Skill Ripjaws DDR3 / GTX 560 Ti

Need technical help for ManiaPlanet? Click here. :)
User avatar
jonthekiller
Translator
Translator
Posts: 4702
Joined: 15 Jun 2010, 11:07
Location: In Maniaplanet Alpha
Contact:

Re: Using ManiaHome Methods

Post by jonthekiller »

I have try the script alone in internet and not ingame at 12h59 and nothing too.

Is it possible to add a debug in the script for maybe see the error?
Image
User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: Using ManiaHome Methods

Post by gouxim »

fastforza wrote:Oops ... I was using the password from one of my other API users. :oops: Although now I'm getting 400 bad request response statuses. :?
You're doing "POST /maniahome/notification/public/" which is made for sending public notifcations (ie. a notification that will be seen by everyone that bookmark the Manialink" but you specify a receiverName in the object so it fails.

If you want instead to send a notification to someone that will be visible to all its buddies, use "POST /maniahome/notification/personal/" instead.

Someday I'll precise the error messages ^^
jonthekiller wrote:I have try the script alone in internet and not ingame at 12h59 and nothing too. Is it possible to add a debug in the script for maybe see the error?
There must be something wrong because I have to trace of requests from the user "jonthekiller|lottomania" in the API access logs. Are you sure you didn't changed the URL or something like that?

If you want more precise messages see that: http://code.google.com/p/maniaplanet-ws ... r_handling
But if the error is really HTTP 500, you may not have much details (we hide most of the error messages for obvious security reasons).
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
jonthekiller
Translator
Translator
Posts: 4702
Joined: 15 Jun 2010, 11:07
Location: In Maniaplanet Alpha
Contact:

Re: Using ManiaHome Methods

Post by jonthekiller »

Can I use the same API account for maniaconnect and for send notification? I use the same actually.

I don't use the same file for maniaconnect and for send notification. It's the same folder.


The player is already authentificate before access to this page but maybe I need to authentificate again? Or I can just take the login like before?
Image
User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: Using ManiaHome Methods

Post by gouxim »

jonthekiller wrote:Can I use the same API account for maniaconnect and for send notification? I use the same actually.
Yes you can.
jonthekiller wrote:The player is already authentificate before access to this page but maybe I need to authentificate again? Or I can just take the login like before?
ManiaConnect Authentication and ManiaHome notifications are 2 distinct things. You just need a normal API user to send notifications, even if you send it to a specific login. But obviously this login can come from a ManiaConnect authentication.

The weird thing is that I actually see your ManiaConnect auth request in the logs, but I don't see anything regarding notifications coming from you in the logs.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
jonthekiller
Translator
Translator
Posts: 4702
Joined: 15 Jun 2010, 11:07
Location: In Maniaplanet Alpha
Contact:

Re: Using ManiaHome Methods

Post by jonthekiller »

With this script :

Code: Select all

<?php
echo "start";
require_once 'libraries/autoload.php';

$login = 'jonthekiller';

$notification = new Maniaplanet\WebServices\Notification();
$notification->receiverName = $login;
$notification->link = 'lottery'; // can also be an URL, or a maniaplanet:/// link
$notification->message = 'jonthekiller has bought a ticket on LottoMania'; // nickname will be prepended in that case
$notification->iconStyle = 'ManiaPlanetLogos';
$notification->iconSubStyle = 'IconPlanetsPerspective';
echo "1";
$maniahome = new Maniaplanet\WebServices\ManiaHome('jonthekiller|lottomania', '****', 'lottery');
echo "2";
$maniahome->postPersonalNotification($notification);

echo "finish";
?>
I can see start12 but not finish.

My script is here : http://www.bczteam.com/~jonthekiller/Ma ... /notif.php
Image
User avatar
fastforza
Posts: 859
Joined: 15 Jun 2010, 11:19
Contact:

Re: Using ManiaHome Methods

Post by fastforza »

gouxim wrote:You're doing "POST /maniahome/notification/public/" which is made for sending public notifcations (ie. a notification that will be seen by everyone that bookmark the Manialink" but you specify a receiverName in the object so it fails.

If you want instead to send a notification to someone that will be visible to all its buddies, use "POST /maniahome/notification/personal/" instead.
All solved now. The methods had confused me. :roflol:

Onto another problem: links do not work. ManiaHome attempts to send me to a Manialink (of the URL). On the wiki page you've explicitly documented it as 'can also be a URL'. I don't know if you meant a link to a manialink (file) or a link to a web page (browser). If the latter is not available, could you look into implementing it? :)
Mania Exchange - Share your maps!

ASUS Maximus IV GENE Z / i7 2600K 3.40Ghz QC / 16GB G.Skill Ripjaws DDR3 / GTX 560 Ti

Need technical help for ManiaPlanet? Click here. :)
User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: Using ManiaHome Methods

Post by gouxim »

jonthekiller wrote:With this script :

Code: Select all

<?php
echo "start";
require_once 'libraries/autoload.php';

$login = 'jonthekiller';

$notification = new Maniaplanet\WebServices\Notification();
$notification->receiverName = $login;
$notification->link = 'lottery'; // can also be an URL, or a maniaplanet:/// link
$notification->message = 'jonthekiller has bought a ticket on LottoMania'; // nickname will be prepended in that case
$notification->iconStyle = 'ManiaPlanetLogos';
$notification->iconSubStyle = 'IconPlanetsPerspective';
echo "1";
$maniahome = new Maniaplanet\WebServices\ManiaHome('jonthekiller|lottomania', '****', 'lottery');
echo "2";
$maniahome->postPersonalNotification($notification);

echo "finish";
?>
I can see start12 but not finish.

My script is here : http://www.bczteam.com/~jonthekiller/Ma ... /notif.php
Can you try to add at the begining:

Code: Select all

error_reporting(E_ALL);
And to replace

Code: Select all

$maniahome->postPersonalNotification($notification);
with

Code: Select all

try
{
    $maniahome->postPersonalNotification($notification);
}
catch(\Exception $e)
{
   var_dump($e);
}
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
gouxim
Nadeo
Nadeo
Posts: 1188
Joined: 14 Jun 2010, 17:20

Re: Using ManiaHome Methods

Post by gouxim »

fastforza wrote:Onto another problem: links do not work. ManiaHome attempts to send me to a Manialink (of the URL). On the wiki page you've explicitly documented it as 'can also be a URL'. I don't know if you meant a link to a manialink (file) or a link to a web page (browser).
I meant "a Manialink URL". I updated the Wiki page.
fastforza wrote:If the latter is not available, could you look into implementing it?
Probably not :teub:. For the whole user experience to be good, we want to avoid that when you click on a link it opens the Web browser. However, you can easilly do a Manialink page that opens a Web page ; that way the user experience is better as the players knows that if he continues, it'll open his web browser. For instance "themaniablog" do that in Maniaplanet, and TM-Carpark do that in TMF.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
jonthekiller
Translator
Translator
Posts: 4702
Joined: 15 Jun 2010, 11:07
Location: In Maniaplanet Alpha
Contact:

Re: Using ManiaHome Methods

Post by jonthekiller »

I have nothing new in the page.
Image
Post Reply

Return to “Maniaplanet Web Services”

Who is online

Users browsing this forum: No registered users and 1 guest