Using ManiaHome Methods
Moderator: NADEO
Re: Using ManiaHome Methods
Oops ... I was using the password from one of my other API users. 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.
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.
- jonthekiller
- Translator
- Posts: 4702
- Joined: 15 Jun 2010, 11:07
- Manialink: maniaolympics
- Location: In Maniaplanet Alpha
- Contact:
Re: Using ManiaHome Methods
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?
Is it possible to add a debug in the script for maybe see the error?
Re: Using ManiaHome Methods
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.fastforza wrote:Oops ... I was using the password from one of my other API users. Although now I'm getting 400 bad request response statuses.
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 ^^
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?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?
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!
- jonthekiller
- Translator
- Posts: 4702
- Joined: 15 Jun 2010, 11:07
- Manialink: maniaolympics
- Location: In Maniaplanet Alpha
- Contact:
Re: Using ManiaHome Methods
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?
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?
Re: Using ManiaHome Methods
Yes you can.jonthekiller wrote:Can I use the same API account for maniaconnect and for send notification? I use the same actually.
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.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?
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!
- jonthekiller
- Translator
- Posts: 4702
- Joined: 15 Jun 2010, 11:07
- Manialink: maniaolympics
- Location: In Maniaplanet Alpha
- Contact:
Re: Using ManiaHome Methods
With this script :
I can see start12 but not finish.
My script is here : http://www.bczteam.com/~jonthekiller/Ma ... /notif.php
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";
?>
My script is here : http://www.bczteam.com/~jonthekiller/Ma ... /notif.php
Re: Using ManiaHome Methods
All solved now. The methods had confused me.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.
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.
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.
Re: Using ManiaHome Methods
Can you try to add at the begining:jonthekiller wrote:With this script :
I can see start12 but not finish.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"; ?>
My script is here : http://www.bczteam.com/~jonthekiller/Ma ... /notif.php
Code: Select all
error_reporting(E_ALL);
Code: Select all
$maniahome->postPersonalNotification($notification);
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!
Re: Using ManiaHome Methods
I meant "a Manialink URL". I updated the Wiki page.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).
Probably not . 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.fastforza wrote:If the latter is not available, could you look into implementing it?
Please do not PM for support. Instead, create a thread so that everyone can contribute or benefit from the answer!
- jonthekiller
- Translator
- Posts: 4702
- Joined: 15 Jun 2010, 11:07
- Manialink: maniaolympics
- Location: In Maniaplanet Alpha
- Contact:
Who is online
Users browsing this forum: No registered users and 1 guest