Getting error in LIstCustomer method using JAVA API

Hi All

 

I am working on Square Java API and when I am trying to call the listCustomers method, its throwing the following exception , Please help.

com.squareup.connect.ApiException: {"errors":[{"category":"INVALID_REQUEST_ERROR","code":"INVALID_VALUE","detail":"Pagination cursor is not compatible with this request.","field":"cursor"}]}

 

Here is my code :
ListCustomersResponse result = apiInstance.listCustomers(cursor);

            List<Customer> customers = result1.getCustomers();
            for(Customer customer : customers){
                //System.out.println(customer.getGivenName() +  " = "  + customer.getId() );
                List<Card> customerCards = customer.getCards();
                for(Card card : customerCards){
                     System.out.println(customer.getEmailAddress() +  ","  + customer.getId() + "," + card.getId());
                }

3,108 Views
Message 1 of 3
Report
2 REPLIES 2
Alumni

Hey @joshyuster, thanks for reaching out here and sorry to hear about the trouble. I don't have the answer on hand right now but I'll surface your post with our API Team. We'll be back a soon as we have any additional insight.

 

Also, in the future—feel free to check out Square Connect's Stack Overflow page. It's been a great resource for our developer community, and there's already a ton of questions that have been answered there.

️ Tom | he/him
Square Community Program Manager | Square, Inc.
Find step-by-step help in our Support Center
3,091 Views
Message 2 of 3
Report
Alumni

Circling back here—it looks like you were able to get in touch with our API Team by the time we got tor your post. Hopefully you were able to get everything sorted out. Our Engineering Team will be working to address the cursor issues. If anything else comes up, feel free to reply here or follow up with the team member assisting with  your case.

️ Tom | he/him
Square Community Program Manager | Square, Inc.
Find step-by-step help in our Support Center
3,086 Views
Message 3 of 3
Report