Integer as HTTP Body Parameter

Describe the issue/error/question

Hi all, I am trying to access an API and am having trouble passing an integer value as a body parameter. It seems that the value is not interpreted as an integer. Can you help me with this?

Reagrds René

What is the error message (if any)?

ERROR: UNKNOWN ERROR - check the detailed error for more information
{ “api_version”: “3.1”, “code”: 422, “message_list”: [ { “details”: { “length”: [ “u’123’ is not of type ‘integer’” ] }, “message”: “Request could not be processed.”, “reason”: “INVALID_REQUEST” } ], “state”: “ERROR” }

Please share the workflow

image

Information on your n8n setup

  • Operating System: Windows 10
  • n8n version: 0.198.2
  • Database you’re using (default: SQLite): default
  • Running n8n with the execution process [own(default), main]: default
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: npm

If you want to send it as an integer you can change the parameter to an expression and set:

{{ 123 }}

If you set the value dynamically via an expression based on another parameter which is already an integer, it will also send it as an integer. If it is a string then you should use parseInt to convert, it in the expression.

3 Likes

Works perfectly! Thanks @jan

Great to hear. Have fun!

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