Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core.cs is less forgiving for parameter 'yourZendeskURL' than ZendeskApi.cs is #312

Closed
janvanderhaegen opened this issue Nov 21, 2017 · 3 comments

Comments

@janvanderhaegen
Copy link

The ZendeskApi implementation can handle a variety of inputs for 'yourZendeskURL' and will transform the url.
For example, "contoso", "contoso.zendesk.com", "http://contoso.zendesk.com" etc will all work, the input is transformed into "https://contoso.zendesk.com/api/v2/".

However, the Core base class (used as the base class for HelpCenterApi amongst others) is less forgiving, at a first glance it only adds the trailing slash but nothing else.

@mozts2005
Copy link
Member

I am missing what the issue here is. What are you asking to be changed ?

@janvanderhaegen
Copy link
Author

Hey @mozts2005 ,

I looked at the example.cs as documentation on how to use the library

            string userName = "[email protected]"; // the user that will be logging in the API aka the call center staff 
            string userPassword = "&H3n!0q^3OjDLdm";
            string companySubDomain = "csharpapi"; // sub-domain for the account with Zendesk
            int pageSize = 5;
           var api = new ZendeskApi(companySubDomain, userName, userPassword);

However, when one cannot use the HelpCenterApi in the same way...

            string userName = "[email protected]"; // the user that will be logging in the API aka the call center staff 
            string userPassword = "&H3n!0q^3OjDLdm";
            string companySubDomain = "csharpapi"; // sub-domain for the account with Zendesk
            int pageSize = 5;
           var api = new HelpCenterApi(companySubDomain, userName, userPassword, null, null, null);

I'm suggesting to refactor the HelpCenterApi to accept the same values for 'companySubDomain' as the normal ZendeskApi would:

  1. "csharpapi", "csharpapi.zendesk.com"
  2. "http://csharpapi.zendesk.com"
  3. "https://csharpapi.zendesk.com"
  4. "https://csharpapi.zendesk.com/api/v2"

Currently, only the 4th option works, which isn't apparent at all.

@mozts2005 mozts2005 changed the title Core.js is less forgiving for parameter 'yourZendeskURL' than ZendeskApi.cs is Core.cs is less forgiving for parameter 'yourZendeskURL' than ZendeskApi.cs is Nov 21, 2017
@mozts2005
Copy link
Member

mozts2005 commented Nov 21, 2017

Ok, Got it. That is not how it should be used at all.
try following this https://github.com/mozts2005/ZendeskApi_v2/blob/master/test/ZendeskApi_v2.Test/HelpCenter/ArticleTests.cs

the only class that you should ever "New" is the ZendeskApi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants