Ant
May 1, 2023, 7:53pm
1
I want to get a list of all invoices with Draft Status using “status_id=1” with
GET /api/v1/invoices
But it appears from the API Documentation Invoice Ninja API Spec that you don’t currently have this enabled.
It seams the only status you can filter for is the Invoice Object status: "status=active,archived,deleted"
which is not the same as the Invoice status.
Can you add Invoice Status to the list of query parameters.
156. const String kInvoiceStatusViewed = '-3';
157. const String kInvoiceStatusUnpaid = '-2';
158. const String kInvoiceStatusPastDue = '-1';
159. const String kInvoiceStatusDraft = '1';
160. const String kInvoiceStatusSent = '2';
161. const String kInvoiceStatusPartial = '3';
162. const String kInvoiceStatusPaid = '4';
163. const String kInvoiceStatusCancelled = '5';
164. const String kInvoiceStatusReversed = '6';
Thanks,
Anthony.
david
May 2, 2023, 4:59am
3
@Ant
You’ll want to use the query filter ?client_status=
the statuses are
paid
unpaid
overdue
all
you can also chain them like this if needed
?client_status=overdue,unpaid
or just
?client_status=unpaid
Ant
May 2, 2023, 8:47am
4
@david
Ah ok, thanks. So am I right that I can’t filter for just “Draft” invoices?
david
May 2, 2023, 9:51am
5
@Ant
Not currently, but i’ll add it into the next release
Just to note the only supported statuses are as follows:
const STATUS_DRAFT = 1;
const STATUS_SENT = 2;
const STATUS_PARTIAL = 3;
const STATUS_PAID = 4;
const STATUS_CANCELLED = 5;
const STATUS_REVERSED = 6;
The negative ones are calculated statuses.
/**
* @return Builder
* @throws RuntimeException
*/
public function status_id(string $status = ''): Builder
{
if (strlen($status) == 0) {
return $this->builder;
}
return $this->builder->whereIn('status_id', [explode(",", $status)]);
}
1 Like
Ant
May 27, 2023, 2:13pm
6
Hi @david
So these are only status currently supported in the Filter query ?client_status=
paid
unpaid
overdue
all
It would be really useful to have all the statuses available, specifically these two:
draft
sent
Any chance of getting these added?
Cheers,
Anthony.
david
May 28, 2023, 2:25am
7
@Ant
In our next hosted release ( 28th May ) this particular is available, you can use
/api/v1/invoices?status_id=1,2,3
1 Like
Ant
May 29, 2023, 9:43am
8
Thanks @david ,
Just tested that now and its working perfectly.
Cheers,
Anthony.
1 Like