[422] Invalid Parameter despite filtering out bad character | Community
Skip to main content
RAshley
Level 3
October 21, 2024
Solved

[422] Invalid Parameter despite filtering out bad character

  • October 21, 2024
  • 1 reply
  • 722 views

I have a scenario that ends in a custom API to do a POST call.

 

It's throwing an occasional "[422] Invalid Parameter" error. Apparently, some users are pasting control characters (namely TAB) into task names and when fusion throws them into the JSON response it's failing.

 

I've tried using the ascii() function, which seems to strip the character out, but the error is still being thrown, which I don't understand at all.

 

Thoughts?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sven-iX

Fair enough. 
2 options: 

  1. the replace() function if you know it's really a tab only
  2. use the regex module to remove any characters that are NOT allowed. 

 

[^a-zA-Z0-9\.\-\(\)\[\]\{\}'":;\/,\-_\+ ]​

 

  • Some characters have a back-slash because they have special meaning in RegExp.

 

 

1 reply

Sven-iX
Community Advisor
Community Advisor
October 21, 2024

Try Trim()?

 

That should take care of whitespace - not sure about other non-printing characters

RAshley
RAshleyAuthor
Level 3
October 22, 2024

Trim() only takes care of the beginning and end of the string, the ones I'm dealing with are in the middle.

Sven-iX
Community Advisor
Sven-iXCommunity AdvisorAccepted solution
Community Advisor
October 22, 2024

Fair enough. 
2 options: 

  1. the replace() function if you know it's really a tab only
  2. use the regex module to remove any characters that are NOT allowed. 

 

[^a-zA-Z0-9\.\-\(\)\[\]\{\}'":;\/,\-_\+ ]​

 

  • Some characters have a back-slash because they have special meaning in RegExp.