Titus Ubah • almost 11 years ago
Full working Example of SPICEWORKS API
Hello Moderators, i need to integrate Helpdesk API to my app as per requirements.
The API Data is not in JSON format rather it can be accessed via javascript. Can you please provide may one or 2 examples on how to read and display the Help Desk API via the javascript in this link
https://spiceworks.github.io/developers.spiceworks.com//documentation/cloud-apps/reference/helpdesk/
thanks
Comments are closed.

7 comments
Michael Gerbush Manager • almost 11 years ago
Hi Chinelo!
Here's a link to a simple example Node.js app that uses the Helpdesk API: https://github.com/spiceworks/spiceworks-js-sdk/tree/master/examples/hello-world. This app just grabs the first page of the list of all tickets and dumps the response into the page.
You can see the relevant code here: https://github.com/spiceworks/spiceworks-js-sdk/blob/master/examples/hello-world/public/index.js.
If you want to run the app, follow the instructions here https://github.com/spiceworks/spiceworks-js-sdk/blob/master/examples/README.md.
If you are wondering how to do something specific, let me know and I can post some code to show you how. Otherwise, we also have some more complex examples that I can share.
Let me know if there is anything else I can do to help.
Mike
Titus Ubah • almost 11 years ago
Thanks for the response, I am not good at node.js. what am asking is just straight.
For instance to read and display device name, the full API reference is here
https://spiceworks.github.io/developers.spiceworks.com//documentation/cloud-apps/
I have uploaded the code on my server. here
http://fredcare.com/device.txt
it works well
Now am trying to read and display the HelpDesk Data. For instance to read and display List all tickets visible by the current authenticated user:
I amended the above code but cannot get it to work.
Here is the way I amended it by calling
card.services('helpdesk').request('tickets'[, options])
Full code is here, can you help me fix that
http://fredcare.com/helpdesk.txt
Finally, I can see that Help Desk API may require Authentication. can you also provide full authentication code as well.
If I can get this to work. i believe I can do something amazing. waiting for your response
Thanks
Titus Ubah • almost 11 years ago
Hello, @Michael Gerbush. Any Code Update or Fixes yet
Its urgent.
Thanks
Michael Gerbush Manager • almost 11 years ago
The Help Desk API should not require any authentication. It will automatically get Help Desk data for the currently logged in user.
For the code that you posted, it looks like you are calling the `request` method twice, but it should only be called one time to make the API request. Once the data is returned, you will want to use the `data.tickets` property not `data.helpdesk`.
Try changing your code a little, to something like this:
$(document).ready(function(){
var card = new SW.Card();
// List all tickets visible by the current authenticated user:
// get an instance of the helpdesk API service
var helpdesk = card.services('helpdesk');
// make the 'tickets' API request to the helpdesk API service
helpdesk.request('tickets').then(function(data){
// append each ticket summary to the body tag
$.each(data.tickets, function(index, ticket){
$('body').append('' + ticket.summary + ');
});
});
});
Titus Ubah • almost 11 years ago
Thanks for your response. I have implemented that and am okay.
Finally, Please I need to create session Login using Spicywork API but the Code is some how scattered, can you please help provide a full working Session based Login Code that will redirect a user to my welcome page.
below is how i tried to reassemble the login code.
http://fredcare.com/spicy_session_login.txt
Can you please help me fix the issue to make things easier for me and others
Again i will need an explanation on how the following variables are obtained whether from my System or from Spicework API.
auid: environment.app_host.auid,
user_auid: environment.user.user_auid,
access_token: access_token
please help me fix this login code as its what is keeping me from submitting my applications
Thanks.
Michael Gerbush Manager • almost 11 years ago
Hi all, please see my response in this other discussion: http://spiceworks.challengepost.com/forum_topics/4812-i-need-working-script-for-spicwork-api-session-login-urgent-please.
Michael Gerbush Manager • almost 11 years ago
Hi, we have added a simple form you can submit to request an App ID and Secret, so that you can start using the Spiceworks Login API to test user authentication: http://www.surveygizmo.com/s3/2206835/Challenge-Post-Access-Token-Request.