Home Forums Support Can't Update Invoices Via API

This topic contains 1 reply, has 2 voices, and was last updated by  Hillel Coren 2 months, 2 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #21427

    rmurph46
    Participant

    I’m trying to update an invoice’s discount amount using a PUT cURL but keep getting an html page with the message “Whoops, looks like something went wrong.”

    This is the code I’m running:
    $url = ‘https://account.website.com/api/v1/invoices/11878’;
    $data = json_encode(array(
    ‘discount’ => 50
    ));
    $response = putObjectNinja($url, $data);

    I know putObjectNinja works fine because I can update the client’s name using the same function:

    $url = ‘https://account.trunorthwarranty.com/api/v1/clients/12’;
    $data = json_encode(array(
    ‘name’ => “New ClientName”,
    ));
    $response = putObjectNinja($url, $data);

    Any ideas what would be preventing me from updating the invoice’s discount amount?

    #21443

    Hillel Coren
    Keymaster

    When updating an invoice you need to pass in all of the current values. You’ll typically want to use a GET to load the invoice, make the change and then save it.

    We plan to change this in v2 to support only changing specified fields.

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

You must be logged in to reply to this topic.

Posted in: