XeroAPI / Xero-NetStandard

A wrapper of the Xero API in the .NetStandard 2.0 framework. Supports Accounting, Payroll AU/US, and Files
MIT License
127 stars 124 forks source link

GetContactByContactNumberAsync Method is Misnamed #399

Closed strongus closed 2 years ago

strongus commented 3 years ago

Describe the bug Calling the GetContactsByContactNumberAsync and passing in the ContactNumber doesn't work/retrieve the contact because the method is actually querying for the ContactId not the ContactNumber. I tried it out in the Explorer just to confirm I am not crazy.

Steps to reproduce the behavior:

  1. In Xero, find a Contact that has been has a ContactNumber field that is not empty and copy the number(though it's actually a string, but I digress).
  2. Go the Xero Developer API Explorer, select the Accounting API, Contacts endpoint and the "Get Contact by Contact Number" operation.
  3. Paste the copied ContactNumber from step 1 into the ContactNumber parameter textbox
  4. Run the search and it comes back empty
  5. Go back to that same contact in Xero and instead copy the AccountId from the query parameter in the browser address bar and repeat the search using the ContactId as the parameter and the API returns the Contact.

Expected behavior The method should return the Contact if you pass in the ContactNumber value instead of the ContactId OR the method should be renamed GetContactsByContactIdAsync.

JRising-Xero commented 2 years ago

Hi strongus, Checking with the latest version of the SDK this doesn't seem to be an issue. GetContactsByContactNumberAsync is returning the appropriate contact given a valid ContactNumber:

image image

Interestingly, if you pass the id of the contact the method still returns the correct contact, so, under the hood it filters on both contactNumber and contactId.

image

Hope this helps :)