Giter Site home page Giter Site logo

cloudbees-oss / zendesk-java-client Goto Github PK

View Code? Open in Web Editor NEW
148.0 49.0 248.0 1.31 MB

A Java client library for interacting with Zendesk

Home Page: https://developer.zendesk.com/rest_api/docs/api-clients/java#zendesk-java-client-by-cloudbees

License: Apache License 2.0

Java 100.00%
support-team

zendesk-java-client's People

Contributors

aheritier avatar andy-may-at avatar artichikin avatar christ66 avatar dependabot-preview[bot] avatar dependabot[bot] avatar dohbedoh avatar duemir avatar enmustafaj avatar gvh1234 avatar johnou avatar jonnybbb avatar mary-dcouto avatar maxixcom avatar nickw-indeed avatar nkharabaruk avatar pierrebtz avatar richarddbarnett avatar sandeepkaul avatar satamas avatar sceutre avatar sircpl avatar stephenc avatar tandrup avatar timveil avatar tomb50 avatar topero avatar walti91 avatar ydubreuil avatar yusuke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zendesk-java-client's Issues

Publish 0.2.5-SNAPSHOT to maven central

Hi.

Will you publish 0.2.5 to maven central?

I see you have published 0.2.4, but this version has a bug I reported here which gives me a bit of a hard time: #33

Regards,
Lars

Implementation of /api/v2/users/create_or_update_many.json

This API does not have the implementation of the /api/v2/users/create_or_update_many.json method.

Accepts an array of up to 100 user objects. For each user, the user is created if it does not already exist, or the existing user is updated. It is painful to send the request to /create_many.json, parse thru the response and update each user in the list who already existed.

createUserIdentity should return Identity

public void createUserIdentity

should be

public Identity createUserIdentity

to match all the other creation methods (and to make it easier to get the id of the created identity).

Stuck lookupUserByEmail operation

Hello,

We've noticed an issue with lookupUserByEmail operation. Iterable result sometimes stuck on hasNext operation. We have next code:

Iterable<User> users = getClient().lookupUserByEmail(email);
if (users != null) {
    for (Iterator<User> iterator = users.iterator(); iterator.hasNext(); ) {
        User user = iterator.next();
        id = user.getId();
        break;
    }
}

It doesn't look very optimized actually... Anyway, hasNext stucked infinite on future.get()
Here is thread dump

Thread 11342: (state = BLOCKED)
 - sun.misc.Unsafe.park(boolean, long) @bci=0 (Compiled frame; information may be imprecise)
 - java.util.concurrent.locks.LockSupport.park(java.lang.Object) @bci=14, line=186 (Compiled frame)
 - java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt() @bci=1, line=834 (Interpreted frame)
 - java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(int) @bci=72, line=994 (Compiled frame)
 - java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(int) @bci=24, line=1303 (Interpreted frame)
 - java.util.concurrent.CountDownLatch.await() @bci=5, line=236 (Interpreted frame)
 - com.ning.http.client.providers.netty.future.NettyResponseFuture.get() @bci=4, line=152 (Interpreted frame)
 - org.zendesk.client.v2.Zendesk.complete(com.ning.http.client.ListenableFuture) @bci=1, line=1584 (Interpreted frame)
 - org.zendesk.client.v2.Zendesk.access$1200(com.ning.http.client.ListenableFuture) @bci=1, line=74 (Interpreted frame)
 - org.zendesk.client.v2.Zendesk$PagedIterable$PagedIterator.hasNext() @bci=73, line=1761 (Interpreted frame)

We've found a thread stucked for 4 days.
I don't know root issue for this, maybe Zendesk doesn't answer.
Could you please advice?

Potential bug in getOrganizationUsers

Hi.

When calling Zendesk.getOrganizationUsers() I get the following stacktrace:
java.lang.NoClassDefFoundError: com/damnhandy/uri/template/UriTemplate
at org.zendesk.client.v2.TemplateUri.(TemplateUri.java:21)
at org.zendesk.client.v2.Zendesk.tmpl(Zendesk.java:1283)
at org.zendesk.client.v2.Zendesk.getOrganizationUsers(Zendesk.java:443)

When I look at the implementation, I see that it is implemented different from Zendesk.getUsers()

getUsers() uses cnst, whereas getOrganizationUsers uses tmpl.

When running curl https://{subdomain}.zendesk.com/api/v2/organizations/{id}/users.json
-v -u {email_address}:{password} it returns the expected result.

Implementation of /api/v2/users/update_many.json

Hi,
Great job with this API, but there's no implementation of the /api/v2/users/update_many.json method.

This is greatly usefull to update a batch of users. Updating a batch of users one by one require a lot of thread to be opened.

Thanks in advance

Just added a new functionality for the Locale API entry

Hey there, as it was needed by our project. I added the full support for Locales in your code and added the property "locale" to the entity "User" that was missing. I also corrected a problem with the PageIterator in situations where no items were found. If you guys so desire, I can put the code here, or you can add me as a developer in our project.

 Cheers,

Joao Gonzalez

How about subclassing ZendeskResponseException for cases like Rate Limiting

I'm looking to subclass ZendeskResponseException to specially capture the 429 Rate Limiting error. That error returns useful information including the time to wait before trying again. So my plan is to simply grep through the Response and add a few extra fields on the exception.

Not a problem so far but I'm having trouble writing a small unit test that will trigger a 429 from a sandbox instance. Any ideas on how to provoke one are welcome.
https://support.zendesk.com/hc/en-us/articles/203691336-Best-practices-for-avoiding-rate-limiting

(on the subject of our rate limit problems - we already have ehcache and are now actively trying to refine our cache usage but it's tough when you can't easily capture and respond to this particular error. Then I'll head towards a network cache)

Is there going to be a new maven release for getTicketsIncrementally changes?

I'm trying to use the zendesk-java-client for a grails project, but I need the getTicketsIncremetnally() functionality. I have tried cloning and creating a jar file and using that in my grails project but it has given me a ton of issues and headaches. Are you guys planning on uploading a new version with the getTicketsIncrementally() functionality to Maven?

Please update async-http-client to 1.9.x

Hello, we have another dependency that requires async-http-client 1.9.x. It would be great if zendesk-java-client could update to 1.9.x, there are only a few breaking interface changes that impact zendesk-java-client.

    <dependency>
      <groupId>com.ning</groupId>
      <artifactId>async-http-client</artifactId>
      <version>1.7.12</version>
    </dependency>

1.9.3 is the latest version.

Thanks!

Create User Response HTTP/404 Not Found: {"error":"RecordNotFound","description":"Not found"}

Environment:

<dependency>
    <groupId>com.cloudbees.thirdparty</groupId>
    <artifactId>zendesk-java-client</artifactId>
    <version>0.4.0</version>
</dependency>

I have some codes:

final User upUser = new User();
upUser.setActive(true);
upUser.setEmail("[email protected]");
upUser.setName("Rudi Wijaya");
upUser.setVerified(true);
upUser.setOrganizationId(3506655818l);

zendesk.createUser(upUser);

And I got error:

00:48:00.964 [New I/O worker #1] DEBUG org.zendesk.client.v2.Zendesk - Response HTTP/404 Not Found
{"error":"RecordNotFound","description":"Not found"}

Anyone can help ๐Ÿ‘

Found a bug in organisation/{id}/getusers

In the code, the url is wrong in the function:
public Iterable getOrganizationUsers(long id) {
return new PagedIterable(tmpl("/organization/{id}/users.json").set("id", id),
handleList(User.class, "users"));
}

I changed "organization" with "organizations" locally, and got the expected response.

OrganizationActivity SubEvent

Getting this error when pulling down some data:

org.zendesk.client.v2.ZendeskException: java.lang.IllegalArgumentException: Could not resolve type id 'OrganizationActivity' into a subtype of [simple type, class org.zendesk.client.v2.model.events.Event]
at [Source: N/A; line: -1, column: -1](through reference chain: org.zendesk.client.v2.model.Audit["events"])

getSearchResults query containing "+" don't work

I am attempting to query users with a phone number. So using getSearchResults like so.

client.getSearchResults(User.class, "phone:+16465551000");

I was testing queries with known numbers so I expected to get results but got none. I turned on debugging and it looks like the "+" is not being properly escaped.

GET /api/v2/search.json?query=phone%3A+16465551000+type%3Auser

So you can see that the plus is not escaped. Also note the "+" between the number and type.

From my initial look at the code + is used to insert a space in the url. Is there a reason a space wasn't used which the underlying com.damnhandy.uri.template.UriTemplate would then properly escape? I have tried using UriTemplate directly and when it is passed "type:user phone:+16465551000" it does produce a properly escaped url.

JobStatus related to createTickets doesn't seem to contain Ticket entities

In the case of Zendesk#createTickets it doesn't seem like JobStatus#results contains Ticket entities.

Given I want to create multiple tickets, and one or more of those tickets contains a validation error:

JobStatus<Ticket> jobStatus = zendesk.createTickets(tickets);

When I receive the JobStatus (or perform further Zendesk#getJobStatus), the JSON received is:

{
    "job_status": {
        "id": "1",
        "url": "https://subdomain.zendesk.com/api/v2/job_statuses/1.json",
        "total": 1,
        "progress": 0,
        "status": "failed",
        "message": "Failed at 2016-01-15 10:39:18 +0000",
        "results": [{
            "index": 0,
            "error": "TicketCreateFailed",
            "details": "Description: cannot be blank"
        }]
    }
}

But it's deserialized as (toString representation):

JobStatus{
  id='1',
  url='https://subdomain.zendesk.com/api/v2/job_statuses/1.json',
  total=1,
  progress=0,
  status=failed,
  message='Failed at 2016-01-15 10:39:18 +0000',
  results=[
    Ticket{
      assigneeId=null,
      id=null,
      url='null',
      externalId='null',
      type='null',
      subject='null',
      description='null',
      /* other properties omitted */
    }
  ]
}

Even when all the tickets are created successfully, deserialization of the JobStatus may fail as the JSON $.job_status.results.status value can be Updated which doesn't map to a Ticket#status enum value, e.g.:

"results":[
 {
    "id":4,
    "title":"Test 2 - ignore",
    "action":"update",
    "status":"Updated",
    "success":true,
    "errors":""
}

will cause:

java.lang.IllegalArgumentException: Can not construct instance of org.zendesk.client.v2.model.Status from String value 'Updated': value not one of declared Enum instance names: [new, open, pending, hold, solved, closed, deleted]

I'm not sure what the answer to this would be but I just wanted to make other people aware of this potential problem.

Issues with umlauts

Hi there, not sure where to start looking at. When I add any name or alias with umlauts, like "Peter Mรผller", I get an Unprocessable Entity Exception.

Articles update doesn't work anymore (it updates only metadata)

Based on

https://developer.zendesk.com/rest_api/docs/help_center/articles#update-article

These endpoints update article-level metadata such as its promotion status or sorting position. The endpoints do not update translation properties such as the article's title, body or draft. See Translations.

Thus the update of a ticket can work anymore and we need to update the translation even if this is the main .

https://github.com/cloudbees/zendesk-java-client/blob/master/src/main/java/org/zendesk/client/v2/Zendesk.java#L1391

In the Comment class, please change the type of the 'id' field from Integer to Long.

Hello,

I tried to create a ticket comment, retrieve its id and then try to do some other operations.

The comment look like this:

{"id":16410690801,"type":"Comment","author_id":455892302,"body":"Test comment for claim with guid 0146cb8a-b653-4a31-ae29-fe191e57a4c1","html_body":"

Test comment for claim with guid 0146cb8a-b653-4a31-ae29-fe191e57a4c1

","public":true,"trusted":true,"attachments":[],"via":{"channel":"api","source":{"from":{},"to":{},"rel":null}},"metadata":{"system":{"client":"NING/1.0","ip_address":"81.12.206.146","location":"Romania","latitude":46.0,"longitude":25.0},"custom":{}},"created_at":null}

The comment id will cast to a number like this "-769178383".

After that, when I try to execute an operation with that id, I receive a HTTP response similar to this one:

Response HTTP/{} {}
{}
404
Not Found
{"error":"RecordNotFound","description":"Not found"}

Thank you.

Problem with custom fields

Hi, i'm trying to create a user with custom fields, and getting a exception, can you help me?

                User user = new User();
        user.setName(nome);
        user.setEmail(email);
        user.setRole(Role.END_USER);
        Map<String, Object> userFields = new HashMap<String,Object>();
        userFields.put("cnpj_parceiro", idParceiro);
        user.setUserFields(userFields);
        return zd.createUser(user);

How to debug this error: HTTP/422: Unprocessable Entity

I occasionally get the HTTP/422: Unprocessable Entity error using the client. When I do a curl request, in the response from Zendesk there is a helpful error message. For example, here is one for trying to create a user:

{"error":"RecordInvalid","description":"Record validation errors","details":{"email":[{"description":"Email: [email protected] is already being used by another user","error":"DuplicateValue"}]}}

Is there any way to surface this error using the library? This would be extremely helpful for debugging. Thanks in advance.

createUpload issue when passing in token

It looks like the code specifies a bad pattern when passing in a token:

TemplateUri uri = this.tmpl("/uploads.json{?filename}{?token}").set("filename", fileName);
if(token != null) {
uri.set("token", token);
}

If a token exists, the resulting URI is /uploads.json?filename=myfile.jpg?token=abc123
The second ? should be a & to work correctly - currently multiple file upload results in creating a new token for each file

Maven Repo

Any plans to publish the 0.0.3 version of this to the Maven repository?

More descriptive Exception handling?

It looks like createUser(User user) and updateUser just throw a ZendeskException without any messages if the update/create fails. I'm running this API as a periodic job (every 15 minutes), so it would be helpful to have descriptive messages, possibly returning the HTTP response code or the JSON response body on user creation. If this is already available, how can I get this information on user creation/update?

Ticket#dueAt is serialised incorrectly

When a Ticket is serialised it seems that dueAt is represented by a long instead of an ISO 8601 formatted String. This causes the API to reject the request.

Actual:

{"ticket":{"type":"task","has_incidents":false,"due_at":1420070462000}}

Expected:

{"ticket":{"type":"task","has_incidents":false,"due_at":"2015-01-01T00:01:02.000Z"}}

I fixed this in a fork (see: jon-ruckwood@3f11239), I'm not sure if that's useful at all.

New AgentMacroReference Event Type

Came across this in our ETL process, it appears to be a new Zendesk Event type that's not implemented, and apparently no documentation from Zendesk.

Sample Event from a ticket audit entry:

{
            "id": 121204214906,
            "type": "AgentMacroReference",
            "via": {
                "channel": "web",
                "source": {
                    "from": {},
                    "to": {},
                    "rel": null
                }
            },
            "macro_title": "Workflow Stage: Problem Definition",
            "macro_id": "49985043"
        }

Sample error for unrecognized event (Zendesk Java Client 0.4.0):

Unexpected error
org.zendesk.client.v2.ZendeskException: java.lang.IllegalArgumentException: Could not resolve type id 'AgentMacroReference' into a subtype of [simple type, class org.zendesk.client.v2.model.events.Event]
 at [Source: N/A; line: -1, column: -1] (through reference chain: org.zendesk.client.v2.model.Audit["events"])
    at org.zendesk.client.v2.Zendesk.complete(Zendesk.java:1873)
    at org.zendesk.client.v2.Zendesk.access$1300(Zendesk.java:83)
    at org.zendesk.client.v2.Zendesk$PagedIterable$PagedIterator.hasNext(Zendesk.java:2055)
    at org.pentaho.di.trans.steps.zendesk.ZendeskInputTicketAudit.processRow(ZendeskInputTicketAudit.java:115)
    at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Could not resolve type id 'AgentMacroReference' into a subtype of [simple type, class org.zendesk.client.v2.model.events.Event]
 at [Source: N/A; line: -1, column: -1] (through reference chain: org.zendesk.client.v2.model.Audit["events"])
    at com.ning.http.client.providers.netty.future.NettyResponseFuture.done(NettyResponseFuture.java:220)
    at com.ning.http.client.providers.netty.handler.HttpProtocol.finishUpdate(HttpProtocol.java:194)
    at com.ning.http.client.providers.netty.handler.HttpProtocol.handleChunk(HttpProtocol.java:451)
    at com.ning.http.client.providers.netty.handler.HttpProtocol.handle(HttpProtocol.java:474)
    at com.ning.http.client.providers.netty.handler.Processor.messageReceived(Processor.java:88)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:142)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.handler.codec.http.HttpContentDecoder.messageReceived(HttpContentDecoder.java:135)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:452)
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536)
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.handler.codec.http.HttpClientCodec.handleUpstream(HttpClientCodec.java:92)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:310)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    ... 1 more
Caused by: java.lang.IllegalArgumentException: Could not resolve type id 'AgentMacroReference' into a subtype of [simple type, class org.zendesk.client.v2.model.events.Event]
 at [Source: N/A; line: -1, column: -1] (through reference chain: org.zendesk.client.v2.model.Audit["events"])
    at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:2518)
    at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:2445)
    at org.zendesk.client.v2.Zendesk$PagedAsyncListCompletionHandler.onCompleted(Zendesk.java:1697)
    at org.zendesk.client.v2.Zendesk$PagedAsyncListCompletionHandler.onCompleted(Zendesk.java:1681)
    at com.ning.http.client.AsyncCompletionHandler.onCompleted(AsyncCompletionHandler.java:55)
    at com.ning.http.client.providers.netty.future.NettyResponseFuture.getContent(NettyResponseFuture.java:177)
    at com.ning.http.client.providers.netty.future.NettyResponseFuture.done(NettyResponseFuture.java:214)
    ... 41 more
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Could not resolve type id 'AgentMacroReference' into a subtype of [simple type, class org.zendesk.client.v2.model.events.Event]
 at [Source: N/A; line: -1, column: -1] (through reference chain: org.zendesk.client.v2.model.Audit["events"])
    at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:164)
    at com.fasterxml.jackson.databind.DeserializationContext.unknownTypeException(DeserializationContext.java:701)
    at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:155)
    at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:98)
    at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:82)
    at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:107)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:228)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:203)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:23)
    at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:375)
    at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:98)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:308)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:121)
    at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:2513)
    ... 47 more

zendesk.createGroups got {"error":"InvalidEndpoint","description":"Not found"}

final Group newGroup = new Group();
newGroup.setName("Group 1");
zendesk.createGroups(ImmutableList.of(newGroup));

<dependency>
    <groupId>com.cloudbees.thirdparty</groupId>
    <artifactId>zendesk-java-client</artifactId>
    <version>0.3.2</version>
</dependency>

03:30:43.509 [New I/O worker #1] DEBUG com.ning.http.client.providers.netty.channel.ChannelManager - Adding key: https://tuneeca.zendesk.com:443 for channel [id: 0xc1994af0, /192.168.0.114:57475 => tuneeca.zendesk.com/192.161.156.1:443]
03:30:43.514 [New I/O worker #1] DEBUG org.zendesk.client.v2.Zendesk - Response HTTP/404 Not Found
{"error":"InvalidEndpoint","description":"Not found"}
03:30:43.518 [New I/O worker #1] DEBUG com.ning.http.client.AsyncCompletionHandler - HTTP/404: Not Found
org.zendesk.client.v2.ZendeskResponseException: HTTP/404: Not Found
    at org.zendesk.client.v2.Zendesk$PagedAsyncListCompletionHandler.onCompleted(Zendesk.java:1681)
    at org.zendesk.client.v2.Zendesk$PagedAsyncListCompletionHandler.onCompleted(Zendesk.java:1661)
    at com.ning.http.client.AsyncCompletionHandler.onCompleted(AsyncCompletionHandler.java:55)
    at com.ning.http.client.providers.netty.future.NettyResponseFuture.getContent(NettyResponseFuture.java:177)
    at com.ning.http.client.providers.netty.future.NettyResponseFuture.done(NettyResponseFuture.java:212)
    at com.ning.http.client.providers.netty.handler.HttpProtocol.markAsDone(HttpProtocol.java:204)
    at com.ning.http.client.providers.netty.handler.HttpProtocol.finishUpdate(HttpProtocol.java:189)
    at com.ning.http.client.providers.netty.handler.HttpProtocol.exitAfterHandlingBody(HttpProtocol.java:402)
    at com.ning.http.client.providers.netty.handler.HttpProtocol.handleHttpResponse(HttpProtocol.java:429)
    at com.ning.http.client.providers.netty.handler.HttpProtocol.handle(HttpProtocol.java:476)
    at com.ning.http.client.providers.netty.handler.Processor.messageReceived(Processor.java:89)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.handler.stream.ChunkedWriteHandler.handleUpstream(ChunkedWriteHandler.java:142)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.handler.codec.http.HttpContentDecoder.messageReceived(HttpContentDecoder.java:108)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:459)
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:536)
    at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:435)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.handler.codec.http.HttpClientCodec.handleUpstream(HttpClientCodec.java:92)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:296)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(FrameDecoder.java:462)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.callDecode(FrameDecoder.java:443)
    at org.jboss.netty.handler.codec.frame.FrameDecoder.messageReceived(FrameDecoder.java:303)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)
    at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:88)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.process(AbstractNioWorker.java:108)
    at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:337)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:89)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:178)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Ticket dueAt field does not serialize properly

Trying to use the setDueAt method to set a due date for a Ticket of type Task, I get the following error when I try to call Zendesk::createTicket

Here's the offending code:

Ticket ticket= new Ticket();
ticket.setRequesterId(requesterId);
ticket.setAssigneeId(agentId);
ticket.setSubject(subject);
ticket.setComment(new Comment(comment));
ticket.setCustomFields(processCustomFieldMap(customFields));
ticket.setType(Type.TASK);
ticket.setDueAt(DateTime.now().withTimeAtStartOfDay().plusDays(1).plusHours(2).toDate());
Ticket responseTicket = zendesk.createTicket(ticket);

Here's the error:

[New I/O worker #1] DEBUG org.zendesk.client.v2.Zendesk - Response HTTP/400 Bad Request
{
  "error": {
    "title": "Invalid attribute",
    "message": "You passed an invalid value for the due_at attribute. It must be an acceptable ISO 8601 date format"
  }
}

This field gets serialized in zendesk-java-client. I don't see any special date formatters, so I'm not sure this has actually been tested (at least there are no test cases setting the dueAt date of Ticket). If I'm doing it incorrectly, I'd appreciate some guidance.

Edit: It appears that a fix could be as simple as some of the suggestions on the following thread on StackOverflow: http://stackoverflow.com/a/31613581/3022173

If this is a bug, I am willing to write a fix with a test and issue a pull request.

Audit Log support?

Any plans to add Audit Log support to the client? I see ticket auditing but nothing for user auditing.

Problems with URL encoding

In method shown below:

public Iterable<Ticket> getTicketsFromSearch(String searchTerm) {
        return new PagedIterable<Ticket>(tmpl("/search.json{?query}").set("query", searchTerm + "+type:ticket"),
                handleList(Ticket.class, "results"));
}

There is a "+type:ticket" parameter being added to the query. This results in the query not working as the "+" is encoded to %2b before submitting to the API.

The corrected method is shown below

public Iterable<Ticket> getTicketsFromSearch(String searchTerm) {
        return new PagedIterable<Ticket>(tmpl("/search.json{?query}").set("query", searchTerm + " type:ticket"),
                handleList(Ticket.class, "results"));
}

With a space (" ") instead of a "+" the space correctly encodes to %20 (which works).

This is in https://github.com/cloudbees/zendesk-java-client/blob/master/src/main/java/org/zendesk/client/v2/Zendesk.java

Please examine files to see where such problem may occur again. For example:

public <T extends SearchResultEntity> Iterable<T> getSearchResults(Class<T> type, String query, String params) {
        String typeName = null;
        for (Map.Entry<String, Class<? extends SearchResultEntity>> entry : searchResultTypes.entrySet()) {
            if (type.equals(entry.getValue())) {
                typeName = entry.getKey();
                break;
            }
        }
        if (typeName == null) {
            return Collections.emptyList();
        }
        return new PagedIterable<T>(tmpl("/search.json{?query,params}")
                .set("query", query + "+type:" + typeName)
                .set("params", params),
                handleList(type, "results"));
}

But the second method somehow works

Ticket "id" field?

It doesn't seem like the Ticket object's "id" field is available? Am I missing something?

Update: This may just be me not reading closely enough... looks like all Request objects inherit the getId() field. My apologies!

user_fields

Can you add user_fields to User?

I just tried to add:

private Map<String,String> fields = new HashMap<>();
@JsonProperty("user_fields")
public Map<String,String> getFields() { return fields; }
public void setFields(Map<String,String> fields) { this.fields = fields; }

and it seems to work fine

Infinite loop when reading tickets returned by "org.zendesk.client.v2.Zendesk#getTicketsIncrementally(java.util.Date)"

Hello!
First of all I would like to introduce myself a bit: I am a Java EE developer that is currently working integrating Liferay Portal and Zendesk. I have found this project (thank you for your effort!) and I would like to help as much as I can to improve it.

And now, going to the point, I have noticed that "org.zendesk.client.v2.Zendesk.PagedAsyncListCompletionHandler#setPagedProperties in "org.zendesk.client.v2.Zendesk#handleIncrementalList" is not taking into account what is said at https://developer.zendesk.com/rest_api/docs/core/incremental_export#polling-strategy

Resulting that Zendesk is being queried using the same "next_page" value until Zendesk returns an HTTP 429 error code (Too many requests).

A fix is available at my working copy. I want to make a pull request soon. I hope to do not mess things up (it will be my first PR in GitHub :S)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.