Using ManiaHome Methods

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

Moderator: NADEO

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

Using ManiaHome Methods

Post 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.
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
m4rcel
Posts: 650
Joined: 15 Jun 2010, 11:12
Contact:

Re: Using ManiaHome Methods

Post 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 ^^
ImageImage
Image
User avatar
fastforza
Posts: 850
Joined: 15 Jun 2010, 11:19
Contact:

Re: Using ManiaHome Methods

Post 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). ;)
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: 1186
Joined: 14 Jun 2010, 17:20

Re: Using ManiaHome Methods

Post 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
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
fastforza
Posts: 850
Joined: 15 Jun 2010, 11:19
Contact:

Re: Using ManiaHome Methods

Post by fastforza »

Excellent. :yes: Notifications are being sent now.
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: 4629
Joined: 15 Jun 2010, 11:07
Location: In Maniaplanet Alpha
Contact:

Re: Using ManiaHome Methods

Post 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.
Image
User avatar
gouxim
Nadeo
Nadeo
Posts: 1186
Joined: 14 Jun 2010, 17:20

Re: Using ManiaHome Methods

Post by gouxim »

Can you try again and give me the exact time so I can check in the error log?
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
User avatar
fastforza
Posts: 850
Joined: 15 Jun 2010, 11:19
Contact:

Re: Using ManiaHome Methods

Post 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.
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: 4629
Joined: 15 Jun 2010, 11:07
Location: In Maniaplanet Alpha
Contact:

Re: Using ManiaHome Methods

Post by jonthekiller »

I have try at 10h45 and 30 seconds and same.
Image
User avatar
gouxim
Nadeo
Nadeo
Posts: 1186
Joined: 14 Jun 2010, 17:20

Re: Using ManiaHome Methods

Post 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.
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer! 8-)
Post Reply

Return to “Maniaplanet Web Services”

Who is online

Users browsing this forum: No registered users and 1 guest