rest api update put : method not allowed

I get a methodnotallowed when updating an invoice
I have used newtonjson to create a c# class from a json invoice
then i changed some parameters (not the id of course)
then i do a put but i get a method not allowed


        client = new RestClient("");
        var request = new RestRequest("api/v1/invoices/{id}", Method.PUT);
        // easily add HTTP Headers
        request.AddHeader("Content-Type", "application/json");
        request.AddHeader("X-Ninja-Token", "xxxx");
        request.AddHeader("X-Requested-With", "XMLHttpRequest");

        request.AddParameter("id", id);
        var res=client.Execute(request);

how can i do an update ?
is there a postman sample available?

One problem I see is you’re using HTTP instead of HTTPS, the API will redirect to HTTPS which may cause the error.

Hi, https is not working it’s with http
pls can you help me ?

If you’re using you won’t be able to use HTTP.

Are you seeing a specific error with HTTPS?

I don’t understand it
i can have with postman a get operation

its http if i change to https it’s not working
can you pls create a postman script ?

We don’t support accessing our API using HTTP.

If you send a request using HTTP it will 301 forward to HTTPS, I assume the code you’re using is handling the 301 for a GET but not a PUT.

I am trying this
curl -X PUT -H “Content-Type:application/json” -d ‘{“id”: 17,”client_id”: 40 }’ -H “X-Ninja-Token: tokenid” -H “X-Requested-With: XMLHttpRequest”

I get following
{“error”:{“message”:“Invalid token”}}curl: (6) Could not resolve host: 17,”client_id”

i am sure my token is valid because i use it for the get operation

What are you trying to do, we don’t support changing the client id for an invoice.

Hi i want to update the public_notes
state : paid / etc

later i want to add invoiceitems

which fields can be changed ?

in fact i am serializing a complete invoice and the change some fields
and put it back
so which fields can be changed ?

Pretty much every field but the client it.

The error you’re seeing is pretty odd, it looks like you may be trying to send two requests.

Make sure you aren’t copy/pasting from this forum, unless the code is enclosed in backticks the quotes are changed.

i am using postman to test
PUT command


i want to change public_notes of invoice 17
in body data i put
“public_notes”: “dsqfsdf”

then i have error : something went wrong

To update an existing invoice you need to pass back all of the data, I think the error is occurring because the invoice_items property isn’t set.