InvoiceOcean API
Dank API lässt sich System InvoiceOcean leicht mit anderen Applikationen in Verbindung setzen. In Beispielen geben wir Aufrufe mithilfe des Werkzeuges CURL - Du kannst sie einfach auf jede Programmierungssprache wechseln.
Bitte kontaktiere uns, wenn Du eine zusätzliche API-Funktion brauchst. Wir bemühen uns sie schnell einzufügen.
Alle Beispiele funktionieren mit JSON oder XML (man muss nur die Erweiterung xml auf json wechseln). Alle Aufrufe API funktionieren mit SSL, deswegen ist es empfehlenswert in einer Produktionsversion HTTP auf HTTPS zu ändern.
ACHTUNG: Die vollständige Dokumentation befindet sich auf GitHub https://github.com/InvoiceOcean/apiAPI Token
API-Token muss man von Applikationseinstellungen herunterladen (Einstellungen -> Kontoeinstellungen -> Integration -> API Autorisierungscode)Rechnungen
Alle Rechnungen vom bestimmten Zeitraum herunterladen
Rechnungen vom aktuellen Monat herunterladen:
XML curl "https://YOUR_DOMAIN.invoiceocean.de/invoices.xml?period=this_month&api_token=API_TOKEN"
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/invoices.json?period=this_month&api_token=API_TOKEN"
man kann dieselben Parameter übermitteln wie in der App übermittelt werden (auf der Seite der Rechnungsliste)
Gewählte Rechnung nach ID herunterladen
XML curl "https://YOUR_DOMAIN.invoiceocean.de/invoices/100.xml?api_token=API_TOKEN"
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/invoices/100.json?api_token=API_TOKEN"
Herunterladen von Rechnung als PDF
curl "https://YOUR_DOMAIN.invoiceocean.de/invoices/100.pdf?api_token=API_TOKEN"
Sendung von Rechnung an einen Kunden per E-Mail
XML curl -X POST "https://YOUR_DOMAIN.invoiceocean.de/invoices/100/send_by_email.xml?api_token=API_TOKEN"
JSON curl -X POST "https://YOUR_DOMAIN.invoiceocean.de/invoices/100/send_by_email.json?api_token=API_TOKEN"
Herunterladen von Rechnung nach Bestellung-ID
XML curl "https://YOUR_DOMAIN.invoiceocean.de/invoices.xml?oid=nr_zam&api_token=API_TOKEN"
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/invoices.json?oid=nr_zam&api_token=API_TOKEN"
Download invoice by Id of document which was generated based on that invoice
XML curl "https://YOUR_DOMAIN.invoiceocean.de/invoices.xml?invoice_id=id&api_token=API_TOKEN"
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/invoices.json?invoice_id=id&api_token=API_TOKEN"
Download invoice by Id of document which was base of that invoice
XML curl "https://YOUR_DOMAIN.invoiceocean.de/invoices.xml?from_invoice_id=id&api_token=API_TOKEN"
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/invoices.json?from_invoice_id=id&api_token=API_TOKEN"
Neue Rechnung hinzufügen
JSON (empfohlen)JSON (empfohlen)
curl https://YOUR_DOMAIN.invoiceocean.de/invoices.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"invoice": {
"kind":"vat",
"number": null,
"sell_date": "2019-02-18",
"issue_date": "2019-02-18",
"payment_to": "2019-02-25",
"seller_name": "Seller SA",
"seller_tax_no": "5252445767",
"buyer_name": "Client1 SA",
"buyer_tax_no": "5252445767",
"positions":[
{"name":"Produkt A1", "tax":23, "total_price_gross":10.23, "quantity":1},
{"name":"Produkt A2", "tax":0, "total_price_gross":50, "quantity":2}
]
}}'
Code CURL herunterladen
Mit Daten von Standard-Abteilung :
curl https://YOUR_DOMAIN.invoiceocean.de/invoices.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"invoice": {
"kind":"vat",
"number": null,
"sell_date": "2019-02-18",
"issue_date": "2019-02-18",
"payment_to": "2019-02-25",
"buyer_name": "Client1 SA",
"buyer_tax_no": "5252445767",
"positions":[
{"name":"Produkt A1", "tax":23, "total_price_gross":10.23, "quantity":1},
{"name":"Produkt A2", "tax":0, "total_price_gross":50, "quantity":2}
]
}}'
Code CURL herunterladen
XML
curl https://YOUR_DOMAIN.invoiceocean.de/invoices.xml
-u 'login:YOUR_PASSWORD'
-H 'Accept: application/xml'
-H 'Content-Type: application/xml'
-d '<invoice>
<kind>vat</kind>
<sell_date>2019-02-18</sell_date>
<issue_date>2019-02-18</issue_date>
<payment_to>2019-02-25</payment_to>
<seller_name>Seller SA</seller_name>
<seller_tax_no>5252445767</seller_tax_no>
<buyer_name>Client1 SA</buyer_name>
<buyer_tax_no>5252445767</buyer_tax_no>
<positions>
<position>
<name>Produkt X1</name>
<tax>23</tax>
<total_price_gross>20</total_price_gross>
<quantity>1</quantity>
</position>
<position>
<name>Produkt X2</name>
<tax>0</tax>
<total_price_gross>10</total_price_gross>
<quantity>3</quantity>
</position>
</positions>
</invoice>'
Code CURL herunterladen
Beispiel in Ruby
endpoint = 'https://YOUR_DOMAIN.invoiceocean.de/invoices.json'
uri = URI.parse(endpoint)
json_params = {
"api_token" => "API_TOKEN",
"invoice" => {
"kind" =>"vat",
"number" => nil,
"sell_date" => "2019-02-18",
"issue_date" => "2019-02-18",
"payment_to" => "2019-02-25",
"buyer_name" => "Client1 SA",
"buyer_tax_no" => "5252445767",
"positions" =>[
{"name" =>"Produkt A1", "tax" =>23, "total_price_gross" =>10.23, "quantity" =>1},
{"name" =>"Produkt A2", "tax" =>0, "total_price_gross" =>50, "quantity" =>2}
]
}}
request = Net::HTTP::Post.new(uri.path)
request.body = JSON.generate(json_params)
request["Content-Type"] = "application/json"
http = Net::HTTP.new(uri.host, uri.port)
response = http.start {|h| h.request(request)}
if response.code == '201'
ret = JSON.parse(response.body)
else
ret = response.body
end
puts ret.to_json
Code Ruby herunterladen
Javascript / Ajax jQuery
json_params = {
"api_token": "API_TOKEN",
"invoice": {
"kind":"vat",
"number": null,
"sell_date": "2019-02-18",
"issue_date": "2019-02-18",
"payment_to": "2019-02-25",
"buyer_name": "Client1 SA",
"buyer_tax_no": "5252445767",
"positions":[
{"name":"Produkt A1", "tax":23, "total_price_gross":10.23, "quantity":1},
{"name":"Produkt A2", "tax":0, "total_price_gross":50, "quantity":2}
]
}}
//alert(JSON.stringify(json_params))
endpoint = 'https://YOUR_DOMAIN.invoiceocean.de/invoices.json'
$.ajax({
type: "POST",
url: endpoint,
data: json_params,
dataType: 'json',
success: function(data) { alert('invoice created! ' + data['number'])},
});
Code JavaScript herunterladen
Rechnung mit dem prozentualen Rabatt hinzufügen
Hinweis: Bevor eine Rechnung erstellt wird, kontrolliere in Kontoeinstellungen ob das Feld "wie den Rabatt rechnen" auf "in Prozent vom Einzelpreis im Netto" eingestellt istcurl https://YOUR_DOMAIN.invoiceocean.de/invoices.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"invoice": {
"kind":"vat",
"number": null,
"sell_date": "2019-02-18",
"issue_date": "2019-02-18",
"payment_to": "2019-02-25",
"seller_name": "Seller SA",
"seller_tax_no": "5252445767",
"buyer_name": "Client1 SA",
"buyer_tax_no": "5252445767",
"show_discount": true,
"discount_kind": "percent_unit",
"positions":[
{"name":"Produkt A1", "tax":23, "total_price_gross":10.23, "quantity":1, "discount_percent": 50},
{"name":"Produkt A2", "tax":0, "total_price_gross":50, "quantity":2, "discount_percent": 10}
]
}}'
Code CURL herunterladen
Rechnung mit Betragrabatt hinzufügen
HINWEIS: Vor Erstellung sollte man überprüfen, ob in Kontoeinstellungen das Feld "Wie den Rabatt berechnen" quotengerecht eingestellt wirdcurl https://YOUR_DOMAIN.invoiceocean.de/invoices.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"invoice": {
"kind":"vat",
"number": null,
"sell_date": "2019-02-18",
"issue_date": "2019-02-18",
"payment_to": "2019-02-25",
"seller_name": "Seller SA",
"seller_tax_no": "5252445767",
"buyer_name": "Client1 SA",
"buyer_tax_no": "5252445767",
"show_discount": true,
"discount_kind": "amount",
"positions":[
{"name":"Produkt A1", "tax":23, "total_price_gross":10.23, "quantity":1, "discount": 5},
{"name":"Produkt A2", "tax":0, "total_price_gross":50, "quantity":2, "discount": 25}
]
}}'
Code CURL herunterladen
Rechnung zum existierenden Kunden und Produkt hinzufügen
Wenn Du ID eines Kunden (client_id), einen Verkäufer (department_id) oder ein Produkt hast, dann brauchst Du keine weiteren Daten mitzuteilen. Die Rechnung wird mit dem aktuellen Datum und mit 5 Tagen Zahlungsfrist erstellt.curl https://YOUR_DOMAIN.invoiceocean.de/invoices.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{"api_token": "API_TOKEN",
"invoice": {
"payment_to_kind": 5,
"department_id": 222,
"client_id": 111,
"positions":[
{"product_id": 333, "quantity":2}
]
}}'
Code CURL herunterladen
Rechnung-Update
curl https://YOUR_DOMAIN.invoiceocean.de/invoices/444.json
-X PUT
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{"api_token": "API_TOKEN",
"invoice": {
"buyer_name": "New buyer name SA"
}}'
Code CURL herunterladen
Die Rechnung löschen
XML curl -X DELETE "https://YOUR_DOMAIN.invoiceocean.de/invoices/100.xml?api_token=API_TOKEN"
JSON curl -X DELETE "https://YOUR_DOMAIN.invoiceocean.de/invoices/100.json?api_token=API_TOKEN"
Warehouse Documents
All warehouse documents
JSONcurl "https://YOUR_DOMAIN.invoiceocean.de/warehouse_documents.json?api_token=API_TOKEN"
man kann dieselben Parameter übermitteln wie in der App übermittelt werden (auf der Seite der Rechnungsliste)
Fetch warehouse document by ID
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/warehouse_documents/555.json?api_token=API_TOKEN"
Add new Goods Received Note
JSON
curl https://YOUR_DOMAIN.invoiceocean.de/warehouse_documents.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"warehouse_document": {
"kind":"pz",
"number": null,
"warehouse_id": "1",
"issue_date": "2019-02-18",
"department_name": "Department1 SA",
"client_name": "Client1 SA",
"warehouse_actions":[
{"product_name":"Produkt A1", "purchase_tax":23, "purchase_price_net":10.23, "quantity":1},
{"product_name":"Produkt A2", "purchase_tax":0, "purchase_price_net":50, "quantity":2}
]
}}'
Code CURL herunterladen
Add new Goods Issued Note
JSON
curl https://YOUR_DOMAIN.invoiceocean.de/warehouse_documents.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"warehouse_document": {
"kind":"wz",
"number": null,
"warehouse_id": "1",
"issue_date": "2019-02-18",
"department_name": "Department1 SA",
"client_name": "Client1 SA",
"warehouse_actions":[
{"product_id":"333", "tax":23, "price_net":10.23, "quantity":1},
{"product_id":"333", "tax":0, "price_net":50, "quantity":2}
]
}}'
Code CURL herunterladen
Add new warehouse document for existing client, department and product
To set default department just skip these keys: department_id and department_nameJSON
curl https://YOUR_DOMAIN.invoiceocean.de/warehouse_documents.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"warehouse_document": {
"kind":"pz",
"number": null,
"warehouse_id": "1",
"issue_date": "2019-02-18",
"department_id": "222",
"client_id": "111",
"warehouse_actions":[
{"product_id":"333", "purchase_tax":23, "price_net":10.23, "quantity":1},
{"product_id":"333", "purchase_tax":0, "price_net":50, "quantity":2}
]
}}'
Code CURL herunterladen
Update warehouse document
curl https://YOUR_DOMAIN.invoiceocean.de/warehouse_documents/555.json
-X PUT
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{"api_token": "API_TOKEN",
"warehouse_document": {
"client_name": "New client name SA"
}}'
Code CURL herunterladen
Delete warehouse document
JSON curl -X DELETE "https://YOUR_DOMAIN.invoiceocean.de/warehouse_documents/100.json?api_token=API_TOKEN"
Produkte / Dienstleistungen
alle Produkte
XML curl "https://YOUR_DOMAIN.invoiceocean.de/products.xml?api_token=API_TOKEN&page=1"
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/products.json?api_token=API_TOKEN&page=1"
Gewähltes Produkt nach ID herunterladen
curl "https://YOUR_DOMAIN.invoiceocean.de/products/100.xml?api_token=API_TOKEN"
Ein Produkt hinzufügen
curl https://YOUR_DOMAIN.invoiceocean.de/products.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{"api_token": "API_TOKEN",
"product": {
"name": "PoroductAA",
"code": "A001",
"price_net": "100",
"tax": "23"
}}'
Code CURL herunterladen
Produkt Update
curl https://YOUR_DOMAIN.invoiceocean.de/products/333.json
-X PUT
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{"api_token": "API_TOKEN",
"product": {
"name": "PoroductAA2",
"code": "A0012",
"price_gross": "102"
}}'
Code CURL herunterladen
Widget
Zum Herunterladen der Zahlung-Widget (in JS-Format) URL angeben:
http://app.Invoiceocean.de/a/YOUR_DOMAIN/p/{{token}}.js
Kunden
Alle Kunden
XML curl "https://YOUR_DOMAIN.invoiceocean.de/clients.xml?api_token=API_TOKEN&page=1"
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/clients.json?api_token=API_TOKEN&page=1"
Gewählten Kunden nach ID aufrufen
curl "https://YOUR_DOMAIN.invoiceocean.de/clients/100.xml?api_token=API_TOKEN"
Select client using their external ID
XML curl "https://YOUR_DOMAIN.invoiceocean.de/clients.xml?external_id=100&api_token=API_TOKEN"
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/clients.json?external_id=100&api_token=API_TOKEN"
Neuen Kunden hinzufügen
curl https://YOUR_DOMAIN.invoiceocean.de/clients.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{"api_token": "API_TOKEN",
"client": {
"name": "Client1",
"tax_no": "5252445767",
"bank" : "bank1",
"bank_account" : "bank_account1",
"city" : "city1",
"country" : "",
"email" : "example@email.com",
"person" : "person1",
"post_code" : "post-code1",
"phone" : "phone1",
"street" : "street1",
"street_no" : "street-no1"
}}'
Code CURL herunterladen
Kundenupdate
curl https://YOUR_DOMAIN.invoiceocean.de/clients/111.json
-X PUT
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{"api_token": "API_TOKEN",
"client": {
"name": "Klient2",
"tax_no": "52524457672",
"bank" : "bank2",
"bank_account" : "bank_account2",
"city" : "city2",
"country" : "PL",
"email" : "example2@email.com",
"person" : "person2",
"post_code" : "post-code2",
"phone" : "phone2",
"street" : "street2",
"street_no" : "street-no2"
}}'
Code CURL herunterladen
Zahlungen
alle Zahlungen
XML curl "https://YOUR_DOMAIN.invoiceocean.de/payments.xml?api_token=API_TOKEN"
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/payments.json?api_token=API_TOKEN"
Gewählte Zahlung nach ID herunterladen
XML curl "https://YOUR_DOMAIN.invoiceocean.de/payments/100.xml?api_token=API_TOKEN"
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/payment/100.json?api_token=API_TOKEN"
Neue Zahlung hinzufügen
minimal JSON (empfohlen)curl https://YOUR_DOMAIN.invoiceocean.de/payments.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"payment": {
"name":"Payment 001",
"price": 100.05,
"invoice_id": null,
"paid":true,
"kind": "api"
}}'
Code CURL herunterladen
full JSON (empfohlen)
curl https://YOUR_DOMAIN.invoiceocean.de/payments.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"payment": {
"city": null,
"client_id":null,
"comment":null,
"country":null,
"currency":"PLN",
"deleted":false,
"department_id":null,
"description":"abonament roczny",
"email":"email@email.pl",
"first_name":"Jan",
"generate_invoice":true,
"invoice_city":"Warszawa",
"invoice_comment":"",
"invoice_country":null,
"invoice_id":null,
"invoice_name":"Company name",
"invoice_post_code":"00-112",
"invoice_street":"street 52",
"invoice_tax_no":"5252445767",
"last_name":"Kowalski",
"name":"Plantnosc za produkt1",
"oid":"",
"paid":true,
"paid_date":null,
"phone":null,
"post_code":null,
"price":"100.00",
"product_id":1,
"promocode":"",
"provider":"transfer",
"provider_response":null,
"provider_status":null,
"provider_title":null,
"quantity":1,
"street":null,
"kind": "api"
}}'
Code CURL herunterladen
Systemkontos
Neues Konto erstellen
JSON (empfohlen)curl https://YOUR_DOMAIN.invoiceocean.de/account.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"account": {
"prefix": "prefix1"
},
"user": {
"login": "login1",
"email": "email1@email.pl",
"password": "password1",
"from_partner": "PARTNER_CODE"
},
"company": {
"name": "Company1",
"tax_no": "5252445700",
"post_code": "00-112",
"city": "Warsaw",
"street": "Street 1/10",
"person": "Jan Nowak",
"bank": "Bank1",
"bank_account": "111222333444555666111"
}
}'
Code CURL herunterladen
More examples: https://github.com/radgost/fakturownia-api
Benutzerinfo herunterladen (samt API Zugangscode)
JSON (empfohlen)curl https://app.invoiceocean.de/login.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"login": "login_or_email1",
"password": "password1"
}'
Code CURL herunterladen
Kontoinformationen herunterladen
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/account.json?api_token=API_TOKEN"
XML curl "https://YOUR_DOMAIN.invoiceocean.de/account.xml?api_token=API_TOKEN"
More examples: https://github.com/radgost/fakturownia-api
Categories
Create new category
JSON (empfohlen)curl https://YOUR_DOMAIN.invoiceocean.de/categories.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"category": {
"name": "my_category",
"description": null
},
}'
Code CURL herunterladen
List of categories
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/categories.json?api_token=API_TOKEN"
XML curl "https://YOUR_DOMAIN.invoiceocean.de/categories.xml?api_token=API_TOKEN"
Obtaining information for a single category by ID
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/categories/100.json?api_token=API_TOKEN"
XML curl "https://YOUR_DOMAIN.invoiceocean.de/categories/100.xml?api_token=API_TOKEN"
More examples: https://github.com/radgost/fakturownia-api
Warehouses
Create new warehouse
JSON (empfohlen)curl https://YOUR_DOMAIN.invoiceocean.de/warehouses.json
-H 'Accept: application/json'
-H 'Content-Type: application/json'
-d '{
"api_token": "API_TOKEN",
"warehouse": {
"name": "my_warehouse",
"kind": null,
"description": null
},
}'
Code CURL herunterladen
List of Warehouses
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/warehouses.json?api_token=API_TOKEN"
XML curl "https://YOUR_DOMAIN.invoiceocean.de/warehouses.xml?api_token=API_TOKEN"
Obtaining warehouse information based on ID
JSON curl "https://YOUR_DOMAIN.invoiceocean.de/warehouses/100.json?api_token=API_TOKEN"
XML curl "https://YOUR_DOMAIN.invoiceocean.de/warehouses/100.xml?api_token=API_TOKEN"
More examples: https://github.com/radgost/fakturownia-api