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

Fault exception / [DatabaseError] with simplest call #18

Open
piranout opened this issue Mar 7, 2014 · 11 comments
Open

Fault exception / [DatabaseError] with simplest call #18

piranout opened this issue Mar 7, 2014 · 11 comments

Comments

@piranout
Copy link

piranout commented Mar 7, 2014

I'm trying to test the viability of this client, but so far I can't get past the simplest invocation I could come up with. My API key is accepted, but the TryInvoke call ultimately throws an exception with this message:

Server returned a fault exception: [4] [DatabaseError]Error returning results

The code is just a simplification of the example app:

const string email = "existing@email.com"; // address copied directly out of a contact
var contact = client.ContactService.FindByEmail(email).FirstOrDefault();
Console.WriteLine("{0} {1}", contact.FirstName, contact.LastName);

Is this something endemic to InfusionSoft, or something wrong in my method call, or something related to whether Mercury is in retrograde at the same time as the Sta-Puff Marshmallow Man is active? :~/

@mfairch
Copy link

mfairch commented Mar 7, 2014

That fault is coming back from Infusionsoft. This means something is causing the database query to error out. With findByEmail you pass in a second parameter of the fields you want returned, I've seen where some fields will randomly error out. Can you provide me more information on this and I can dig in from Infusionsoft's side to see if I can find anything?

If you can provide me your appname and an email address that this is happening on i can take a look. You can email it to me if you would prefer not to post it on here. api@infusionsoft.com

@piranout
Copy link
Author

piranout commented Mar 7, 2014

Thanks for looking at this. I sent those details to api@infusionsoft.com.

If there's a better approach to using the API, I'm open to that. Is using the table service with known column names less error-prone, maybe?

@scottcate
Copy link
Member

I think you have to include the columns that you want in return.

//Find contacts dotnet styleconst string email =
"chris.martin@eventday.com";var contact =
client.ContactService.FindByEmail(email, p => p.Include(c => c.Id)

.Include(c => c.Email));

or

var contact = client.ContactService.FindByEmail(email, p => p.IncludeAll());

Scott Cate
Cell: 602-418-0770
Office: 714-64-EVENT
Fax: 480-304-3023
Follow us on ...
www.facebook.com/EventDay
www.twitter.com/EventDay

*Try EventDay: *Setup your Free Event in 30 Seconds
http://evn.tc/EventDay_Free

On Fri, Mar 7, 2014 at 8:29 AM, piranout notifications@github.com wrote:

Thanks for looking at this. I sent those details to api@infusionsoft.com.

If there's a better approach to using the API, I'm open to that. Is using
the table service with known column names less error-prone, maybe?

Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-37034170
.

@mfairch
Copy link

mfairch commented Mar 7, 2014

If you pass in an empty array for the return fields, it will return the Id only. If you don't even pass in the second parameter, it will return this error: "No method matching arguments: java.lang.String, java.lang.String, java.lang.String".

I think this may be related to something else since he's getting a Database error.

@scottcate
Copy link
Member

could be a mismatch on the apikey, or connection somehow. the error
returned isn't also pointing to the actual problem.

i would try the code samples, just to see if it starts working.

Scott Cate
Cell: 602-418-0770
Office: 714-64-EVENT
Fax: 480-304-3023
Follow us on ...
www.facebook.com/EventDay
www.twitter.com/EventDay

*Try EventDay: *Setup your Free Event in 30 Seconds
http://evn.tc/EventDay_Free

On Fri, Mar 7, 2014 at 8:38 AM, Michael Fairchild
notifications@github.comwrote:

If you pass in an empty array for the return fields, it will return the Id
only. If you don't even pass in the second parameter, it will return this
error: "No method matching arguments: java.lang.String, java.lang.String,
java.lang.String".

I think this may be related to something else since he's getting a
Database error.

Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-37035037
.

@mfairch
Copy link

mfairch commented Mar 7, 2014

I think it might be related to "AccountId" column being asked for. Thats the only field I was able to get this error to throw on.

@piranout
Copy link
Author

piranout commented Mar 7, 2014

The .IncludeAll() construct throws the same database error as the one-parameter .FindByEmail overload call did.

This manual projection works, even with AccountId included. However, it always returns 0 for the AccountId:

var contact = client.ContactService.FindByEmail(
    email, projection => projection
        .Include(c => c.Id)
        .Include(c => c.Company)
        .Include(c => c.FirstName)
        .Include(c => c.LastName)
        .Include(c => c.Email)
        .Include(c => c.State)
        .Include(c => c.PostalCode)
        .Include(c => c.Phone1)).FirstOrDefault();

Still, this is progress. 👍

@scottcate
Copy link
Member

FWIW, we found that the include all will error, and that has something to
do with custom fields.

maybe a custom field is null? or missing on a record? i'm not sure, but
this may help solve the Error.

please keep in touch, i'm interested to see what you find.

Scott Cate
Cell: 602-418-0770
Office: 714-64-EVENT
Fax: 480-304-3023
Follow us on ...
www.facebook.com/EventDay
www.twitter.com/EventDay

*Try EventDay: *Setup your Free Event in 30 Seconds
http://evn.tc/EventDay_Free

On Fri, Mar 7, 2014 at 9:33 AM, piranout notifications@github.com wrote:

The .IncludeAll() construct throws the same database error as the
one-parameter .FindByEmail overload call did.

This manual projection works, even with AccountId included. However, it
always returns 0 for the AccountId:

var contact = client.ContactService.FindByEmail(
email, projection => projection
.Include(c => c.Id)
.Include(c => c.Company)
.Include(c => c.FirstName)
.Include(c => c.LastName)
.Include(c => c.Email)
.Include(c => c.State)
.Include(c => c.PostalCode)
.Include(c => c.Phone1)).FirstOrDefault();

Still, this is progress. [image: 👍]

Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-37040890
.

@piranout
Copy link
Author

piranout commented Mar 7, 2014

Well, adding contact.AccountId to the .Include() calls made the Database Error return.

Could it be that there are nullable fields in the database mapped to non-nullable types in the .NET client? Or is this strictly a SQL query error on the server side?

@mfairch
Copy link

mfairch commented Mar 7, 2014

This is an error on our side. AccountId is mapped to CompanyId but thats for the DataService so that might be why this is happening. I will send up a ticket to development on this.

@piranout
Copy link
Author

piranout commented Mar 7, 2014

Don't know if this is helpful at all, but including .CompanyId gets past the error, but returns 0. (Saying "AccountId" worked in my earlier comment was a typo #18 (comment))

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

No branches or pull requests

3 participants