I'm new here, but I've been working with Kaseya for several months now. For those of you who are still struggling with getting the REST Api to authenticate your account so you can make requests. I modified Kaseya's example slightly,
This is the script:
Simply copy and paste this script into a text file. Save it with a cs extension. So fileName.cs
You'll need Visual Studio since you need to compile the script. So create a new C# Console Project and move the file into the project directory.
All you need to do now is change the URL to match your domain name, your admin Username and Password (located at the bottom of the script).
Then simply run! You'll probably need to have the .NET framework 4.5 at least in order to make the HTTP request the script requires.
If requested, I can compile an executable so that you can simply run the .exe file and get authenticated instantly.
Any questions, let me know!
Thanks for sharing!
I'd recommend moving your statically assigned username, password and URL to configuration settings so they can be modified at any time in an XML file. You would import System.Configuration like this:
Then in your code you could get the values of your parameters like this:
sUsername = ConfigurationManager.AppSettings.Get("Username");
More details here: support.microsoft.com/.../815786
Hi! You're right, I think hard coding is not the best, but I was actually thinking of building a command line executable since I figure most people might struggle compiling the script. With something like (user input in red):
Enter URL here: example.com
Enter Username: MyUsername
Enter Password: MyPassword
It should take maybe 10 minutes to do so, I just wasn't sure whether someone would like to have the executable rather than the script.
I made a GUI for the API along with source code and examples.