Forum sugestii i pomysłów na ulepszenie Fakturowni. Zgłaszaj propozycje zmian, głosuj na pomysły innych użytkowników.

Anonim

How can I correctly delete a product from an invoice using Fakturownia API? (Jak poprawnie usunąć produkt z faktury korzystając z API Fakturownia?)

ere are the details: 1. **Creating an Invoice**: ```sh curl -X POST https://xxx.fakturownia.pl/invoices.json \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "api_token": "QQQ", "invoice": { "kind": "receipt", "lang": "pl", "number": null, "seller_name": "My firma", "show_discount": 1, "positions": [ { "name": "price2", "tax": 20.00000, "total_price_gross": 2000.00, "quantity": 2.0, "discount_percent": 1.0, "discount": 20.0000, "quantity_unit": "szt" }, { "name": "percent2", "tax": 20.00000, "total_price_gross": 2000.00, "quantity": 2.0, "discount_percent": 10.0, "discount": 200.0000, "quantity_unit": "szt" } ], "buyer_company": 0, "buyer_last_name": "0664324794", "buyer_first_name": "0664324794" } }' Updating an Invoice (changing product names): curl -X PUT https://xxx.fakturownia.pl/invoices/304979117.json \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "api_token": "QQQ", "invoice": { "kind": "receipt", "lang": "pl", "seller_name": "My firma", "show_discount": 1, "positions": [ { "id": 720511219, "name": "price3", "tax": 20.00000, "total_price_gross": 2000.00, "quantity": 2.0, "discount_percent": 1.0, "discount": 20.0000, "quantity_unit": "szt" }, { "id": 720511220, "name": "percent3", "tax": 20.00000, "total_price_gross": 2000.00, "quantity": 2.0, "discount_percent": 10.0, "discount": 200.0000, "quantity_unit": "szt" } ], "buyer_company": 0, "buyer_last_name": "0664324794", "buyer_first_name": "0664324794" } }' Issue: I need to delete a product from the invoice. I tried using the deleted field in the PUT request, but it did not work. Attempt to Delete a Product: curl -X PUT https://xxx.fakturownia.pl/invoices/304979117.json \ -H 'Accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "api_token": "QQQ", "invoice": { "kind": "receipt", "lang": "pl", "seller_name": "My firma", "show_discount": 1, "positions": [ { "id": 720511219, "name": "price3", "tax": 20.00000, "total_price_gross": 2000.00, "quantity": 2.0, "discount_percent": 1.0, "discount": 20.0000, "quantity_unit": "szt" }, { "id": 720511220, "deleted": true } ], "buyer_company": 0, "buyer_last_name": "0664324794", "buyer_first_name": "0664324794" } }' Question: How can I correctly delete a product from an invoice using Fakturownia API? Is there a specific field or method I should use? Any advice or examples would be greatly appreciated. Pytanie: Jak mogę poprawnie usunąć produkt z faktury za pomocą Fakturownia API? Czy jest jakieś konkretne pole lub metoda, której powinienem użyć? Wszelkie porady lub przykłady byłyby mile widziane.
Główna odpowiedź Kacper 2024-07-15 09:55

Hello,
here you can find an exemplary request to delete an invoice position:
https://github.com/fakturownia/API?tab=readme-ov-file#f10c

You can find the English documentation here if needed: https://github.com/invoiceocean/API?tab=readme-ov-file#9c, for our international version InvoiceOcean. The documentation is mostly the same.

Best regards,
Kacper

Komentarze (5)

Customer Reviews

Odpowiada mi, jeśli go tutaj dodam.
“additional_fields”: {
“my_id”: 54119771
},

Czy mogę gdzieś zapisać “swój id” dla pozycji faktury, aby móc później znaleźć odpowiedni obiekt z waszym “id”?

“positions”: [
{
“id”: 720604820,
“name”: “price3”,
“tax”: 20.00000,
“total_price_gross”: 2000.00,
“quantity”: 2.0,
“discount_percent”: 1.0,
“discount”: 20.0000,
“quantity_unit”: “szt”,
“my_id”: “local_id_123” # my ID
},

Dziękuję za pomoc!

Kacper

Dziękuję za informację, w przypadku dodatkowych pytań, jestem do dyspozycji.

Pozdrawiam,
Kacper

Dziękuję bardzo! zakończył operację pomyślnie
W mojej prośbie muszę zamienić: „deleted”: true na „_destroy”: 1

Kacper

Główna odpowiedź

Hello,
here you can find an exemplary request to delete an invoice position:
https://github.com/fakturownia/API?tab=readme-ov-file#f10c

You can find the English documentation here if needed: https://github.com/invoiceocean/API?tab=readme-ov-file#9c, for our international version InvoiceOcean. The documentation is mostly the same.

Best regards,
Kacper

Dodaj komentarz