pardot-java-client icon indicating copy to clipboard operation
pardot-java-client copied to clipboard

AddingProspectAccount

Open lzpup opened this issue 4 years ago • 2 comments

Hello, Super fan of this project. I am hoping to pitch in. This is my first contribution.

I am attempting to add support for ProspectAccounts. I have copied your code an implemented. I have duplicated some of your custom field code from Prospect to support the custom fields on the Prospect Account.

I have been testing and it mostly works with my Pardot instance. I have run into one issue with the retrieving the name of the ProspectAccount. I think we overrode the name field with "Name" field and it seems to not retrive the name of any ProspectAccount on my instance, and i get an execption if i don't specify fields and use instead .withName() (example) [I also get this issue if i specify our fields and pass "name"] Exception in thread "main" com.darksci.pardot.api.ParserException: Cannot deserialize instance of java.lang.String out of START_OBJECT token at [Source: (StringReader); line: 77, column: 13] (through reference chain: com.darksci.pardot.api.response.prospectaccount.ProspectAccountQueryResponse["result"]->com.darksci.pardot.api.response.prospectaccount.ProspectAccountQueryResponse$Result["prospectAccount"]->java.util.ArrayList[1]->com.darksci.pardot.api.response.prospectaccount.ProspectAccount["name"]) at com.darksci.pardot.api.PardotClient.submitRequest(PardotClient.java:346) at com.darksci.pardot.api.PardotClient.prospectAccountQuery(PardotClient.java:1108) at com.precor.marketinganalytics.TestCrim.PardotAPIClient.TestQueryAccountName(PardotAPIClient.java:439) at com.precor.marketinganalytics.TestCrim.TestCrimApp.main(TestCrimApp.java:419) Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.lang.String out of START_OBJECT token at [Source: (StringReader); line: 77, column: 13] (through reference chain: com.darksci.pardot.api.response.prospectaccount.ProspectAccountQueryResponse["result"]->com.darksci.pardot.api.response.prospectaccount.ProspectAccountQueryResponse$Result["prospectAccount"]->java.util.ArrayList[1]->com.darksci.pardot.api.response.prospectaccount.ProspectAccount["name"])

Wondering if you could try the branch against your instance and see if its an issue my instance, or the code. Otherwise the rest of the methods work great. Hope I can contribute..

lzpup avatar Nov 17 '20 00:11 lzpup

Awesome! Thanks for the contribution. I'll try to take a look at this soon and let you know what I find.

Crim avatar Nov 17 '20 00:11 Crim

I played around with this a bit today. I think the deserializer needs some work, potentially a custom Deserializer instance. I took a rough stab in the following branch here by adding a couple test cases, and started on a deserializer. I think it's headed in the right direction, but still has issues. I think perhaps the ProspectAccountCustomFieldValueDeserializer is conflicting?

Crim avatar Nov 19 '20 08:11 Crim