Closed abitamaspp closed 2 years ago
Hi @abitamaspp apologies for the long delay. If this is still an issue for you have you tried invoice_numbers
?
From the SDK:
def get_invoices(
self,
xero_tenant_id,
if_modified_since=empty,
where=empty,
order=empty,
i_ds=empty,
invoice_numbers=empty,
contact_i_ds=empty,
statuses=empty,
page=empty,
include_archived=empty,
created_by_my_app=empty,
unitdp=empty,
summary_only=empty,
_return_http_data_only=True,
_preload_content=True,
_request_timeout=None,
):
"""Retrieves sales invoices or purchase bills # noqa: E501
OAuth2 scope: accounting.transactions, accounting.transactions.read
:param str xero_tenant_id: Xero identifier for Tenant (required)
:param datetime if_modified_since: Only records created or modified since this timestamp will be returned
:param str where: Filter by an any element
:param str order: Order by an any element
:param list[str] i_ds: Filter by a comma-separated list of InvoicesIDs.
:param list[str] invoice_numbers: Filter by a comma-separated list of InvoiceNumbers.
:param list[str] contact_i_ds: Filter by a comma-separated list of ContactIDs.
:param list[str] statuses: Filter by a comma-separated list Statuses. For faster response times we recommend using these explicit parameters instead of passing OR conditions into the Where filter.
:param int page: e.g. page=1 – Up to 100 invoices will be returned in a single API call with line items shown for each invoice
:param bool include_archived: e.g. includeArchived=true - Invoices with a status of ARCHIVED will be included in the response
:param bool created_by_my_app: When set to true you'll only retrieve Invoices created by your app
:param int unitdp: e.g. unitdp=4 – (Unit Decimal Places) You can opt in to use four decimal places for unit amounts
:param bool summary_only: Use summaryOnly=true in GET Contacts and Invoices endpoint to retrieve a smaller version of the response object. This returns only lightweight fields, excluding computation-heavy fields from the response, making the API calls quick and efficient.
:param bool _return_http_data_only: return received data only
:param bool _preload_content: load received data in models
:param bool _request_timeout: maximum wait time for response
:return: Invoices
"""
# verify the required parameter 'xero_tenant_id' is set
if xero_tenant_id is None:
raise ValueError(
"Missing the required parameter `xero_tenant_id` "
"when calling `get_invoices`"
)
collection_formats = {
"IDs": "csv",
"InvoiceNumbers": "csv",
"ContactIDs": "csv",
"Statuses": "csv",
}
path_params = {}
query_params = []
if where is not empty:
query_params.append(("where", where))
if order is not empty:
query_params.append(("order", order))
if i_ds is not empty:
query_params.append(("IDs", i_ds))
if invoice_numbers is not empty:
query_params.append(("InvoiceNumbers", invoice_numbers))
if contact_i_ds is not empty:
query_params.append(("ContactIDs", contact_i_ds))
if statuses is not empty:
query_params.append(("Statuses", statuses))
if page is not empty:
query_params.append(("page", page))
if include_archived is not empty:
query_params.append(("includeArchived", include_archived))
if created_by_my_app is not empty:
query_params.append(("createdByMyApp", created_by_my_app))
if unitdp is not empty:
query_params.append(("unitdp", unitdp))
if summary_only is not empty:
query_params.append(("summaryOnly", summary_only))
header_params = {
"xero-tenant-id": xero_tenant_id,
}
if if_modified_since is not empty:
header_params["If-Modified-Since"] = if_modified_since
local_var_files = {}
form_params = []
body_params = None
# HTTP header `Accept`
header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# Authentication setting
auth_settings = ["OAuth2"]
url = self.get_resource_url("/Invoices")
try:
return self.api_client.call_api(
url,
"GET",
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type="Invoices",
response_model_finder=self.get_model_finder(),
auth_settings=auth_settings,
_return_http_data_only=_return_http_data_only,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
collection_formats=collection_formats,
)
except exceptions.HTTPStatusException as error:
raise translate_status_exception(error, self, "get_invoices")
How can I get invoice by its number (invoice number, e.g. "INV-0001")? The existing code now only filters by invoice statuses, and I can't find documentation regarding this
PS: I've tried using
InvoiceNumber
,InvoiceNumbers
,invoicenumbers
,invoicenumber
,Number
,Numbers
,number
, andnumbers
but they gave me unexpected keyword argument error