Home Forums Support Create quotes via REST or csv upload

This topic contains 8 replies, has 2 voices, and was last updated by  Hillel Coren 1 month, 1 week ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #23704

    zarkovbill
    Participant

    Good morning

    I have a requirement to create many quotes via a batch process. It’s clear and I have done it for invoices with no issues but I notice that there is no PUT support in REST for quotes.

    I have compared the database records for a quote and an invoice and as far as I can tell, the only difference is the field “invoice_type_id” which for invoice=1 and quote=2.

    If there is no better way to do it, is it feasible to load to the system as invoices and then do a sql update direct on the field to set as a quote?

    I’m hesitant for 3 reasons:
    1. Strongly prefer not to update DB outside of the app
    2. Uncertain if there any other reference records or control totals which would be made inconsistent
    3. Invoice load always appear to create in status “SENT” and my preference would be “DRAFT”

    I will be trying REST to see if that lets me address #3 but would appreciate any guidance overall.

    Regards

    Mike

    #23705

    Hillel Coren
    Keymaster

    You an use the /invoices route to create quotes, just set invoice_type_id to 2

    #23714

    zarkovbill
    Participant

    Many thanks for the prompt and excellent support as ever – it really gives confidence I chose the right application for my son’s business!

    I therefore assume I’m good to also set invoice_status_id to “1”?

    Regards

    Mike

    #23715

    Hillel Coren
    Keymaster

    It won’t have an effect, the invoice_status_id field is read only

    #23716

    zarkovbill
    Participant

    ok – clear

    Regards

    Mike

    CLOSED

    #23717

    zarkovbill
    Participant

    Apologies…. I have tried many times but the following snippet (Double quotes are there but hidden when I copied – the command runs without error) results in a perfectly formed invoice rather than quote. Can you spot my error?

    curl -X POST http://192.168.0.53:8053/api/v1/invoices -H Content-Type:application/json -d ‘{client_id: 166, invoice_date: 2020-02-26, due_date: 2021-02-26, public_notes: Weekly lessons for Bill and Ted, invoice_type_id:2, invoice_items:[{product_key: SPN-30-G, qty:1}, {product_key: SPN-30-G, qty:1}]}’ -H X-Ninja-Token: vrmorcp0xtojgabzn7btoucy1jlpcxry

    #23718

    Hillel Coren
    Keymaster

    Please try changing invoice_type_id=2 to is_quote=true

    #23719

    zarkovbill
    Participant

    Success!

    Many thanks

    Mike

    #23720

    Hillel Coren
    Keymaster

    Awesome, glad to hear it!

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.

Posted in: