eneifert / zendeskapi Goto Github PK
View Code? Open in Web Editor NEWC# Wrapper for the ZenDesk Api
License: MIT License
C# Wrapper for the ZenDesk Api
License: MIT License
Use ZenDeskApi 1.01 via Nuget
Description:
Try to get an users from defined organization.
(Opganization) oOrg = ZenDeskApi.GetOgranizationById(sOrganizationID); //it's ok.
But oOrg.Users contains null (On a ZenDesk portal this organization has an users). Catched server response (via Fiddler):
2011-05-23T17:56:22+04:00Other strange thing (maybe referenced with one). Method ZenDeskApi.GetUsers returns not of all users.
I have created another visual studio test project to use the functionality of ZenDeskApi. I have added a reference to ZenDeskApi in the test project. When I try to create a new instance of ZenDeskApi, I get an error as ZenDeskApi is looking for some specific location for RestClient ( in the core.cs). My restclient is stored in a different location. Where do I change the location?
I have created a test project as I want to step through the code.
Excellent job on the wrapper. Just one little thing, it's "Zendesk" and not "ZenDesk" ;)
I am trying to upload an attachemnt named Test1234.txt. The api acts like it was successful, however when I open the uploaded file from the ZenDesk ticket it always reads as follows:
filename=Test1234.txt&data-binary=System.Byte%5b%5d
Thanks,
Brandon
* My Code************
System.Collections.Generic.List<ZenFile> zFileList = new System.Collections.Generic.List<ZenFile>();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Session["zFileList"] = null;
}
else if (Session["zFileList"] != null)
{
zFileList = (System.Collections.Generic.List<ZenFile>)Session["zFileList"];
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
ZenDeskApi.ZenDeskApi _api = new ZenDeskApi.ZenDeskApi(Site, Email, Password);
Ticket zdTicket = new Ticket();
zdTicket.RequesterEmail = "[email protected]";
zdTicket.Subject = this.txtSubject.Text;
zdTicket.Description = this.txtContent.Text;
zdTicket.RequesterName = "Joe Blow";
zdTicket.ViaId = (int)TicketViaType.WebServiceOrApi;
zdTicket.TicketTypeId = (int)TicketType.Question;
if (zFileList != null)
{
zdTicket.AttachmentsToken = _api.UploadAttachments(zFileList);
}
int ticketID = _api.CreateTicket(zdTicket);
zdTicket = _api.GetTicketById(ticketID);
}
protected void ProcessUpload(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
ZenDeskApi.ZenDeskApi _api = new ZenDeskApi.ZenDeskApi(Site, Email, Password);
ZenFile zFile = new ZenFile();
zFile.FileName = AsyncFileUpload1.FileName;
zFile.ContentType = AsyncFileUpload1.ContentType;
zFile.FileData = AsyncFileUpload1.FileBytes;
zFileList.Add(zFile);
Session["zFileList"] = zFileList;
}
* My Code************
I have tested the ZenFile and confirmed that I can convert the FileData back to a text file and it looked right. What am I doing wrong??
I'm using an ZendeskApi.GetForums method.
First call of this method returns correct data (List (Of Forum)). But second call returns null. Error message in ((RestSharp.RestResponseBase)(response).ErrorMessage is:
Data at the root level is invalid. Line 1, position 1
.Content contains a value that seems like correct.
What a wonder when i'm restarting my application first call returns a null with same error. The bug dissapears after a while.
ZenDeskApi project contains RestSharp.dll.
RestSharp.dll is referenced to Newton.Json.Net35.dll
Need to add correct assembly from http://json.codeplex.com/releases/view/58535 or change references in RestSharp.dll if it's possible.
Fusion Log:
*** Assembly Binder Log Entry (20.05.2011 @ 12:41:27) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\AREA\DEVELOP\ZendeskSLAConnector\ZendDeskApi\ZExplorer\bin\Debug\ZExplorer.vshost.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = DOMAIN\user
LOG: DisplayName = Newtonsoft.Json.Net35, Version=4.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
(Fully-specified)
LOG: Appbase = file:///C:/AREA/DEVELOP/ZendeskSLAConnector/ZendDeskApi/ZExplorer/bin/Debug/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = ZExplorer.vshost.exe
Calling assembly : RestSharp, Version=100.0.0.0, Culture=neutral, PublicKeyToken=null.
LOG: Start binding of native image Newtonsoft.Json.Net35, Version=4.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed.
WRN: No matching native image found.
LOG: IL assembly loaded from C:\AREA\DEVELOP\ZendeskSLAConnector\ZendDeskApi\ZExplorer\bin\Debug\Newtonsoft.Json.Net35.dll.
Hi, I am creating a ticket using the CreateTicketAsEndUser. I am setting
t.TicketTypeId = (int)TicketType.Problem;
t.PriorityId = (int) TicketPriorities.Urgent;
In Zend it is not showing the ticket created with these settings.
Thanks
Hi,
I am using your Zendesk API Wrapper (Thanks for sharing this!) to import our bugs from 16Bugs.com to ZenDesk. So far I have everything working, except I can't figure out the attachments. First off, I have attachments on the bug itself and the comments in 16Bugs but in ZenDesk it seems like it only allows attachments to comments. Is that right?
For each comment, I am adding attachments if they exist:
//create ticket
...
int ZenID = _api.CreateTicket(ticket);
...
DataRow[] comments = GetComments(bugid); //gets 16Bugs comments for bugid
foreach (DataRow cmt in comments)
{
ZenDeskApi.Model.Comment comment = new ZenDeskApi.Model.Comment();
comment.Value = cmt["Text"].ToString();
comment.IsPublic = true;
comment.AuthorId = ZUSER_BTS;
//Comment Attachments
string cid = cmt["ID"].ToString();
DataRow[] cups = GetAttachments(cid); //gets 16Bugs comment attachments
foreach (DataRow cup in cups)
{
ZenDeskApi.Model.Attachment catt = new ZenDeskApi.Model.Attachment();
catt.ContentType = cup["Content"].ToString();
catt.FileName = cup["Original_Name"].ToString();
catt.Size = Convert.ToInt32(cup["Size"].ToString());
catt.Url = cup["Url"].ToString();
comment.Attachments.Add(catt);
}
_api.AddComment(ZenID, comment);
}
This creates my comment, but with no attachments. Could it be the ContentType? These are the ones I have from 16Bugs:
application/msword
application/pdf
application/vnd.ms-excel
application/vnd.ms-project
application/vnd.openxmlformats-officedocument.word
application/zip
binary/octet-stream
image/gif
image/jpeg
image/png
image/tiff
image/x-bmp
Any help is greatly appreciated!
In GetLoginUrl where the UnixEpoch time is grabbed this is being incremented by 1 day which is an error. This should be the CURRENT epoch time, not a time to when it should expire.
Hey guys,
I no longer have a testing environment that I can use to keep supporting this api. Is anyone else out there willing to take this project over? Let me know and I will post in the zendesk forum to send all future requests to you.
Thanks,
Eric
Nuget package includes copied files for json and restsharp
http://nuget.org/List/Packages/ZenDeskApi
A beter way (for versioning purposes of the external dependencies) would be to use the offical way of adding dependencies;
http://docs.nuget.org/docs/reference/nuspec-reference
Especially for newtonsoft.json that is used a lot. Having that library included as a non versioned dependency will break nugets possibility to help resolving dependency conflicts.
Group.Users and Group.UserIds do not get populated after fetching Group(s) through either GetGroup(groupId) ot GetGroups().
Maybe the Users property should not be in the Group class at all to avoid confusion and instead add a new method GetUsersForGroup(groupId)? I see that the UserIds property is used for the creation and the updates of Groups, though.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.