Page 1 of 3

Using ManiaHome Methods

Posted: 23 Oct 2011, 06:31
by fastforza
There is absolutely no documentation about the ManiaHome notification methods, nor are there any examples (annoying). So how does one use the ManiaHome notification methods?

Notification Class

Code: Select all

class Notification
{
	public $senderName; (string)
	public $receiverName; (string)
	public $message; (string)
	public $link; (string)
	public $isPrivate; // What is this? (bool)
	public $priority; // What is this? (int)
	public $group; // What is this? (string)
	public $iconStyle; (string)
	public $iconSubStyle; (string)
}
Anything marked with // What is this? needs explaining. These new variables must be the reason why my notifications are prevented from being sent. I see it's a lot different than TMF, rather an improvement. But with no documentation it's annoying to figure out how it works, and to send notifications properly. :?

I've ported the library to the .NET framework and I'm sending the notifications from a website. Documentation and an explanation of those methods would be nice. :P

Thanks.

Re: Using ManiaHome Methods

Posted: 23 Oct 2011, 08:44
by m4rcel
The following are only assumptions and must not be true:

$isPrivate says, whether or not all players can see this notification, or only that player who received it. (I never worked with ManiaHome, but I remember that there were methods like sendPublicNotification() and sendPrivateNotification().)
$group may be the Ingame-Groups of ManiaPlanet, so that you can send a Notification to all being part of that group.

$priority is how important the Notification is, but I have no idea what it is exactly for, regarding ManiaHome...


But I agree with you: Documentation needed ^^

Re: Using ManiaHome Methods

Posted: 23 Oct 2011, 09:30
by fastforza
m4rcel wrote:$isPrivate says, whether or not all players can see this notification, or only that player who received it. (I never worked with ManiaHome, but I remember that there were methods like sendPublicNotification() and sendPrivateNotification().)
$group may be the Ingame-Groups of ManiaPlanet, so that you can send a Notification to all being part of that group.

$priority is how important the Notification is, but I have no idea what it is exactly for, regarding ManiaHome..
Those are the same assumptions I made. :) However, I don't know why $isPrivate is necessary when functions like postPublicNotification() and postPrivateNotification() exist. :lol: I'd like to think $isPrivate would be defined on Nadeo's end.

$group is absolutely necessary. I would be able to reach a broader audience with my notifications. 8-)

Changes Since TMF
- $type is missing or has been deprecated.
- sendNotificationFromManialink() deprecated (postNotification() in MPWS - deprecated).
- New function postPersonalNotifiation() (somehow different from postPrivateNotification())
- The player login use to be specified in the URL, but is now specified in $receiverName.

I await information from Gouxim because I still can't grasp how it actually works (still having problems). ;)

Re: Using ManiaHome Methods

Posted: 24 Oct 2011, 12:12
by gouxim
I updated the documentation of the classes on the SVN.

See http://code.google.com/p/maniaplanet-ws ... cation.php
And http://code.google.com/p/maniaplanet-ws ... iaHome.php

I'm also writing a quick article in the wiki with code examples.
edit: http://code.google.com/p/maniaplanet-ws ... /ManiaHome

Re: Using ManiaHome Methods

Posted: 25 Oct 2011, 04:44
by fastforza
Excellent. :yes: Notifications are being sent now.

Re: Using ManiaHome Methods

Posted: 26 Oct 2011, 19:12
by jonthekiller
I have try to sent some notifications but I have all the time error http 500.

Here is the code I have add :

Code: Select all

require_once 'libraries/autoload.php';

$notification = new Maniaplanet\WebServices\Notification();
		$notification->receiverName = $login;
		$notification->link = 'lottery'; // can also be an URL, or a maniaplanet:/// link
		$notification->message = stripslashes($nickname)' has bought a ticket on LottoMania'; // nickname will be prepended in that case
		$notification->iconStyle = 'ManiaPlanetLogos';
		$notification->iconSubStyle = 'IconPlanetsPerspective';

		$maniahome = new Maniaplanet\WebServices\ManiaHome('jonthekiller|lottomania', '*******', 'lottery');
		$maniahome->postPersonalNotification($notification);
$login and $nickname are good. If I quote this, my maniacode works.

Re: Using ManiaHome Methods

Posted: 26 Oct 2011, 23:35
by gouxim
Can you try again and give me the exact time so I can check in the error log?

Re: Using ManiaHome Methods

Posted: 27 Oct 2011, 09:35
by fastforza
Have you changed anything since? I can't send notifications any more. I know I've changed nothing since and all I get is a JSON response:

Code: Select all

{"message":null}
Which for my library means there's a problem, compared to no response. Attempted to send two notifications: one 5 minutes ago, the second about 10. The agent is Mania Exchange.

Re: Using ManiaHome Methods

Posted: 27 Oct 2011, 09:46
by jonthekiller
I have try at 10h45 and 30 seconds and same.

Re: Using ManiaHome Methods

Posted: 27 Oct 2011, 11:07
by gouxim
jonthekiller wrote:I have try at 10h45 and 30 seconds and same.
It's weird, I have no request for that username (jonthekiller|lottomania) except for ManiaConnect token retrievals.
fastforza wrote:Have you changed anything since? I can't send notifications any more. I know I've changed nothing since and all I get is a JSON response
Nop. But I checked the logs and I see "401 Unauthorized". Are you sure you got the right API password? Does it work if you try to, for ex, "GET /players/gouxim/" ?

Protip: when it doesn't work, you should check the HTTP Response Code first. The Response body is only for additional messages.