Create an invoice with sevdesk

Could somebody help me to create a valid invoice with sevdesk? I only get error and it seems my fault somehow.

Using the community node, I get the wrong format for the “Save Invoice Positions” field. Using http-node I have the same problem. Could somebody send me an example cURL for an invoice with 2 positions or an example for the community node?

Thanks very much in advance.

Resources:
API documentation: sevDesk - API
Thread aboud community node (dead?): sevDesk Integration

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I took a look at the docs and I am not sure what “invoice model” is. You need to pass that and it’s an object.

cmmd + f didn’t show it anywhere else in the docs.

If you can reply back with what that is I can help you put the request together

Thanks for your offer to help!

The description of Models are here: sevDesk - API
docs for Invoice positions: sevDesk - API

Using the http-node would be also fine for me, but I started with the sevdesk community node.

When I use this in “Save Invoice Positions”:

    {
      "unity": {
        "id": 1
      },
      "taxRate": 19,
      "objectName": "Position 1",
      "quantity": 2,
      "price": 50
    },
    {
      "unity": {
        "id": 1
      },
      "taxRate": 7,
      "objectName": "Position 2",
      "quantity": 1,
      "price": 80
    },
    {
      "unity": {
        "id": 1
      },
      "taxRate": 19,
      "objectName": "Position 3",
      "quantity": 3,
      "price": 25
    }
  ]

I get

Error code

400

Full message

Request failed with status code 400

Error data

{ "objects": null, "error": { "message": "invoice expected array with 'id' and 'objectName'. array given", "code": null, "data": null, "exceptionUUID": "removed" } }

Here is a screenshot of the node:

I treid the same with the http-node

this ist the body:

{
  "invoice": {
    "objectName": "Invoice",
    "invoiceNumber": "DRAFT-2023-001",
    "invoiceDate": "2023-05-16",
    "contact": {
      "id": 76147211
    },
    "invoiceType": "RE",
    "currency": "EUR"
  },
  "positions": [
    {
      "unity": {
        "id": 1
      },
      "taxRate": 19.0,
      "objectName": "Position 1",
      "quantity": 2,
      "price": 50
    },
    {      
      "unity": {
        "id": 1
      },
      "taxRate": 7.0,
      "objectName": "Position 2",
      "quantity": 1,
      "price": 80
    },
    {
      "unity": {
        "id": 1
      },
      "taxRate": 19.0,
      "objectName": "Position 3", 
      "quantity": 3,
      "price": 25
    }
  ],
  "taxSet": {
    "id": 89398,
    "objectName": "TaxSet"
  }
}

this is the error:

Full message

500 - "{\"objects\":null,\"error\":{\"message\":\"App\\\\InvoiceValidation\\\\BuhaTypeRestrictions::__construct(): Argument #1 ($invoiceType) must be of type string, null given, called in \\/sevserver\\/apps\\/sevdesk\\/application\\/models\\/Invoice.php on line 2268\",\"code\":null,\"data\":null,\"exceptionUUID\":\"faf07cee-f15e-4f21-bffb-eb05ec30e053\"}}"

Request

{ "headers": { "authorization": "---", "accept": "application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7" }, "method": "POST", "uri": "https://my.sevdesk.de/api/v1/Invoice", "gzip": true, "rejectUnauthorized": true, "followRedirect": true, "resolveWithFullResponse": true, "followAllRedirects": true, "timeout": 300000, "body": { "invoice": { "objectName": "Invoice", "invoiceNumber": "DRAFT-2023-001", "invoiceDate": "2023-05-16", "contact": { "id": 76147211 }, "invoiceType": "RE", "currency": "EUR" }, "positions": [ { "unity": { "id": 1 }, "taxRate": 19, "objectName": "Position 1", "quantity": 2, "price": 50 }, { "unity": { "id": 1 }, "taxRate": 7, "objectName": "Position 2", "quantity": 1, "price": 80 }, { "unity": { "id": 1 }, "taxRate": 19, "objectName": "Position 3", "quantity": 3, "price": 25 } ], "taxSet": { "id": 89398, "objectName": "TaxSet" } }, "encoding": null, "json": false, "useStream": true }

the invoice type is defined here:

https://api.sevdesk.de/#tag/Invoice/Attributes-of-an-invoice

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.