Jump to content

How to format 'search by invoice id' API query?


Colin

Recommended Posts

Hi,

I'm new to Blesta.

How do I format my API query to search for a specific invoice by id? I've searched the API and source docs but couldn't find anything.

e.g. I can find invoice #104028 using:

curl --request GET https://mydomain.com/api/invoices/search.json?query=104028&page=1

But if invoice #104028 is  referenced in another invoice's line items it will appear in the search results.

Link to comment
Share on other sites

Unfortunately the Invoices model does not support the level of granularity in searching, though it's looking like it will in Blesta 4.10.

Now this is particularly if you are using the Invoice #.  If you know the internal invoice ID (the id that appears in the url when editing an invoice which comes from the invoices.id column) then you could call

curl --request GET https://mydomain.com/api/invoices/get.json?invoice_id=104028

 

Link to comment
Share on other sites

On 4/15/2020 at 4:13 PM, Colin said:

Thanks. 'get.json?invoice_id=<invoice.id>' works. ? But I see the model method ( source docs) is depreciated?

Yea I notice that the other day, and it is a little misleading.  If you look at the method in the code it's self, this is how the deprecation comment reads:


     * @deprecated since v4.6.0 - The properties of some data returned by this method are deprecated:
     *  - line_items
     *      - taxes_applied
     *      - tax_subtotal
     *      - tax_total
     *      - total
     *      - total_w_tax

 So the method itself is not deprecated, just some of the return values.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...