Error: 422 Unprocessable Entity

Hi Fellow Makers,

I am building a workflow that gets data from a Google Sheet, and insert them into a JSON object using an HTTP Post module, and send this package to a Hungarian invoincig app called “Billingo” to create draft invoices. The endsite has a pretty detailed API documentation, and I’ve already created all the templates needed to create an invoice (partner id, block id, product id - all run smoothly).

My problem is that when sending the data, almost all items are missing. I don’t get a 400 error code which suggests that the JSON syntax is OK. However, all the data are missing. Error code 422 suggests that the endpoint is expecting different data set. So I tried to make sure that date is in a correct date format, strings are strings, numbers are numbers, etc… But no matter how hard I try, it just keeps falling apart. I’ve never encountered this before. Anyone has a suggestion on what to do?

I send you screenshots and bundle input/output. Thank sou guys!

Input bundle:

[
{
“ca”: null,
“qs”: ,
“url”: “https://api.billingo.hu/v3/documents”,
“data”: “{\n "partner_id": 1872007141,\n "block_id": 262536,\n "bank_account_id": 231439,\n "language": "hu",\n "currency": "USD",\n "payment_method": "bankcard",\n "electronic": false,\n "type": "draft",\n "invoice_number": "SSD-72",\n "amount": 5,00,\n "fulfillment_date": "2024-12-28T23:00:00.000Z",\n "due_date": "2024-12-28T23:00:00.000Z",\n "paid": true,\n "comment": "A számla deviza árfolyama: 385.941 HUF/USD",\n "taxcode": "HU90574104",\n "address": {\n "country_code": "US"\n },\n "items": [\n {\n "product_id": 654321,\n "name": "Feliratkozás",\n "quantity": 1,\n "net_unit_price": 5,00,\n }\n ]\n}”,
“gzip”: true,
“method”: “post”,
“headers”: ,
“timeout”: null,
“useMtls”: false,
“bodyType”: “raw”,
“contentType”: “application/json”,
“serializeUrl”: false,
“shareCookies”: false,
“parseResponse”: true,
“followRedirect”: true,
“useQuerystring”: false,
“followAllRedirects”: false,
“rejectUnauthorized”: true
}
]

Output bundle:

[
null
]

1 Like

@Janos could you please paste ‘Request content’ data from the input bundle?

Hi Ronak, sure, here it is:

{
“partner_id”: 1872007141,
“block_id”: 262536,
“bank_account_id”: 231439,
“language”: “hu”,
“currency”: “USD”,
“payment_method”: “bankcard”,
“electronic”: false,
“type”: “draft”,
“invoice_number”: “SSD-72”,
“amount”: 5,00,
“fulfillment_date”: “2024-12-28T23:00:00.000Z”,
“due_date”: “2024-12-28T23:00:00.000Z”,
“paid”: true,
“comment”: “A számla deviza árfolyama: 385.941 HUF/USD”,
“taxcode”: “HU90574104”,
“address”: {
“country_code”: “US”
},
“items”: [
{
“product_id”: 654321,
“name”: “Feliratkozás”,
“quantity”: 1,
“net_unit_price”: 5,00,
}
]
}

And this is how a request body looks like accoring to the app’s (Billingo) API documentation (field types may vary depending on what type of data you are adding or updating)

{
“vendor_id”: “string”,
“partner_id”: 0,
“block_id”: 0,
“bank_account_id”: 0,
“type”: “advance”,
“fulfillment_date”: “2025-02-07”,
“due_date”: “2025-02-07”,
“payment_method”: “aruhitel”,
“language”: “de”,
“currency”: “AUD”,
“conversion_rate”: 1,
“electronic”: false,
“paid”: false,
“items”: [
{
“product_id”: 0,
“quantity”: 0
}
],
“comment”: “string”,
“settings”: {
“mediated_service”: false,
“without_financial_fulfillment”: false,
“online_payment”: “”,
“round”: “five”,
“place_id”: 0
}
}

@Janos Use the following Content, and even if it doesn’t work, toggle the advanced settings and set No to ‘Request compressed content’. Post an error screenshot if it doesn’t work.

{
  "partner_id": "1872007141",
  "block_id": 262536,
  "bank_account_id": 231439,
  "language": "hu",
  "currency": "USD",
  "payment_method": "bankcard",
  "electronic": false,
  "type": "draft",
  "invoice_number": "SSD-72",
  "amount": 5.00,
  "fulfillment_date": "2024-12-28T23:00:00.000Z",
  "due_date": "2024-12-28T23:00:00.000Z",
  "paid": true,
  "comment": "A számla deviza árfolyama: 385.941 HUF/USD",
  "taxcode": "HU90574104",
  "address": {
    "country_code": "US"
  },
  "items": [
    {
      "product_id": 654321,
      "name": "Feliratkozás",
      "quantity": 1,
      "net_unit_price": 5.00
    }
  ],
  "conversion_rate": 1,
  "settings": {
    "mediated_service": false,
    "without_financial_fulfillment": false,
    "online_payment": "",
    "round": "five",
    "place_id": 0
  }
}

Hi Ronak, I copy-pasted your version, and the good news is, that all the previous error messages disappeared! That’s awesome, but I still can’t figure ot how, because when I started to map certain values into your json body, all the error messages came back at once :confused: What might causing that?

Another issue is that even if I use your version, I got another error message: “{“error”:{“message”:“You do not have permission for this operation. Or any ID in request is invalid or you do not have permission.”}}” It looks like as an authorization or subscription error but I double checked it, and I have admin right and I subscribed for bulk API usage, so none of the above should be an issue.

What am I missing?

@Janos, when you create an API key, it asks for the permissions. Please make sure it has ‘Read & Write’ permissions.

Yes, that part is OK. :white_check_mark:

@Janos So, please enter the correct number format for your first question. Their API doesn’t accept the European number format. So please use 5.00 instead of 5,00.

The second question - I doubt you entered incorrect IDs - either incorrect partner_id, block_id, or bank_account_id are incorrect.

Hi there, I managed to solve this. The problem was that the JSON request body was incomplete, because the “Document creation” part of the API documentation was not enough: I also had to insert the necessary key-value pairs described in the “Schemas-DocumentInsert” part of the documentation. This resolved the error 422.

I also used a wrong product ID which resulted error 403. After fixing these, I managed to generate an invoice draft with all the details I needed.

One more take-away lesson from this: if you want to dinamically change the amount of your service (product) do not refer to product_id, just map every piece of information separetly from GS, this way you can change the parameters of a service (product) every time you run it. (If product ID is referred, it won’t let you overwrite data).

Second take-away: if you get an error message within make.com that certain types of data is invalid or missing, don’t take it for granted: maybe they correctly formatted, but there is some other bug in your code that messes up the whole thing.

Thank you for your insights, @Ronak_Bhagdev

2 Likes