XenAPI - XenForo PHP REST API

XenAPI - XenForo PHP REST API 1.4.2

No permission to download
So happy I found this add-on - thank you @Contex !

One request - The ability to chain multiple actions into one API call? (ie - I'd like to get a user's avatar and alerts and only have to issue one http call to do this)
Glad you like it!

I will take a look for a way if you add a feature request to the GitHub issue tracker. I cannot promise you anything as I have not even started to think about how to do this, but I will definitely take a look when I have the time.
 
How I make a Login in C# to api.php

Pleas Help
Check the PHP wrapper I wrote and rewrite it in C#. You would need a way to store the session cookie as the "login" method redirects the browser client to the api.php url. If you don't care about the session, then using the "authenticate" method should be enough.
 
Check the PHP wrapper I wrote and rewrite it in C#. You would need a way to store the session cookie as the "login" method redirects the browser client to the api.php url. If you don't care about the session, then using the "authenticate" method should be enough.
Hello

Thanks for the quick response
But I do not know much about PHP I want to do so:

string Reason = new WebClient().DownloadString("http://lordsackboy.ch/Web/api.php?action=authenticate&username=" + TextBoxUser.Text + "&password=" + TextBoxPassword.Text);

then

MessageBox.Show(Reason);

If authenticate is right then I get the hash as a string But if it is wrong then I get a bad error 400

Sorry for my bad english
I'm still beginners
 
Hello

Thanks for the quick response
But I do not know much about PHP I want to do so:

string Reason = new WebClient().DownloadString("http://lordsackboy.ch/Web/api.php?action=authenticate&username=" + TextBoxUser.Text + "&password=" + TextBoxPassword.Text);

then

MessageBox.Show(Reason);

If authenticate is right then I get the hash as a string But if it is wrong then I get a bad error 400

Sorry for my bad english
I'm still beginners

The API returns a HTTP 400 status code when there's an error, issue or similar. The contents of the response body should tell you exactly what the error is. Do note that the response is always is a JSON object, unless there's a web server error.
 
how do I do in C# json?
Programming questions is something I really can't help you with, you'll have to search a bit.

It's been a while since I've done anything in C# but if I recall correctly there are two libraries that you can use, JSON.NET and Newtonsoft.Json.Linq.

You need to parse the response string into a JSON object, both libraries have a method for that, read up on their documentation.

Good luck!
 
Programming questions is something I really can't help you with, you'll have to search a bit.

It's been a while since I've done anything in C# but if I recall correctly there are two libraries that you can use, JSON.NET and Newtonsoft.Json.Linq.

You need to parse the response string into a JSON object, both libraries have a method for that, read up on their documentation.

Good luck!

Thank you very much
 
Hi,

first at all: Thank you very much for this nice API!

I've got a Website Login and want the User to be loggedin in the Forum too.
I like to use your login-function with a hashed userpassword but I dont know what kind of hash your API/Xenforo expects. How does it work?

Thank in advance!
 
How do you send email confirmation when registering new users with the xenapi? ie '&user_state=email_confirm'.

I havent found anything in the api that lets you send the confirmation email.. so I basically have to instruct all my users to login, and request resend of activation email
 
Last edited:
How do you send email confirmation when registering new users with the xenapi? ie '&user_state=email_confirm'.

I havent found anything in the api that lets you send the confirmation email.. so I basically have to instruct all my users to login, and request resend of activation email

I tried to search for a sulotion for you but i think it's not possible at the moment based on the developer statement here: XenAPI - XenForo PHP REST API
 
I actually figured it out, I looked through old commits of the Api and it used to send emails but I just added it back and it works fine
 
For some reason I keep getting this error message, I've tried reinstalling multiple times and I have the same issue. I'm running PHP 5.5.9 with xF 1.4.9

{"error":3,"message":"Missing argument: \"hash\""}
 
For some reason I keep getting this error message, I've tried reinstalling multiple times and I have the same issue. I'm running PHP 5.5.9 with xF 1.4.9

{"error":3,"message":"Missing argument: \"hash\""}

Re-installing what?

It does not require any installation, also please provide more info, provide your full link or example, which action are you trying to get?
 
Hello @Contex, anyway to check usergroup ID for certain member without fetching the full information about him, Thanks.
Not at the moment, you'd have to submit a feature request for that, I'll see f I can add an argument that allows to specify which values to return.

For some reason I keep getting this error message, I've tried reinstalling multiple times and I have the same issue. I'm running PHP 5.5.9 with xF 1.4.9

{"error":3,"message":"Missing argument: \"hash\""}
Like @Cyb3r mentioned, your HTTP request might be missing the "hash" argument. Or you're not calling any action/method at all. What method are you trying to execute/call?

I actually figured it out, I looked through old commits of the Api and it used to send emails but I just added it back and it works fine
I recall having some issues regarding that and therefore removed it, I'll add an option to enable it in the next version if I don't forget it.
 
Last edited:
Not at the moment, you'd have to submit a feature request for that, I'll see f I can add an argument that allows to specify which values to return.


Like @Cyb3r mentioned, your HTTP request might be missing the "hash" argument. Or you're not calling any action/method at all. What method are you trying to execute/call?


I recall having some issues regarding that and therefore removed it, I'll add an option to enable it in the next version if I don't forget it.

Finally you here hooray. lol

How is life going with you bro?

I was digging in this in the last 5 weeks and I have been amazed with all of it's capabilities, I really love the way it handles everything in such smooth and easy way.

I had couple of issues but I was able to solve them by myself. =)

Also got a one request though it's the most needed thing for me atm, I will send it over PM later. ;)

There's one thing you should edit in the next release (Line 3222):

PHP:
die(json_encode($data));

Change it to:

PHP:
die(json_encode($data, JSON_PRETTY_PRINT));

JSON result will be more organized.
 
Top Bottom