mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 18:27:16 -04:00
Support searching by client.id_number in the API
This commit is contained in:
parent
76c1b0efac
commit
6950ab8aa5
@ -46,11 +46,12 @@ class ClientApiController extends BaseAPIController
|
|||||||
->orderBy('created_at', 'desc')
|
->orderBy('created_at', 'desc')
|
||||||
->withTrashed();
|
->withTrashed();
|
||||||
|
|
||||||
// Filter by email
|
|
||||||
if ($email = Input::get('email')) {
|
if ($email = Input::get('email')) {
|
||||||
$clients = $clients->whereHas('contacts', function ($query) use ($email) {
|
$clients = $clients->whereHas('contacts', function ($query) use ($email) {
|
||||||
$query->where('email', $email);
|
$query->where('email', $email);
|
||||||
});
|
});
|
||||||
|
} elseif ($idNumber = Input::get('id_number')) {
|
||||||
|
$clients = $clients->whereIdNumber($idNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->listResponse($clients);
|
return $this->listResponse($clients);
|
||||||
|
@ -25,11 +25,12 @@ For invoices, quotes, tasks and payments simply change the object type.
|
|||||||
|
|
||||||
curl -X GET ninja.dev/api/v1/invoices -H "X-Ninja-Token: TOKEN"
|
curl -X GET ninja.dev/api/v1/invoices -H "X-Ninja-Token: TOKEN"
|
||||||
|
|
||||||
You can search clients by their email address and invoices by their invoice number.
|
You can search clients by their email address or id number and invoices by their invoice number.
|
||||||
|
|
||||||
.. code-block:: shell
|
.. code-block:: shell
|
||||||
|
|
||||||
curl -X GET ninja.dev/api/v1/clients?email=<value> -H "X-Ninja-Token: TOKEN"
|
curl -X GET ninja.dev/api/v1/clients?email=<value> -H "X-Ninja-Token: TOKEN"
|
||||||
|
curl -X GET ninja.dev/api/v1/clients?id_number=<value> -H "X-Ninja-Token: TOKEN"
|
||||||
curl -X GET ninja.dev/api/v1/invoices?invoice_number=<value> -H "X-Ninja-Token: TOKEN"
|
curl -X GET ninja.dev/api/v1/invoices?invoice_number=<value> -H "X-Ninja-Token: TOKEN"
|
||||||
|
|
||||||
To load a single record specify the Id in the URL.
|
To load a single record specify the Id in the URL.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user