Error 400 Bad Request due to symbol "/"
Question

I get an error - when I enter numbers with a slash in the field. I need to make it skip all characters

Checked the error through the service center

My rest

Solution

try Regex_Replace with pattern "[\(@#$%^&*_+{}\[\]';:/?!~\)]" and replace all characters in the pattern with an empty string ("")

Hi,


You should use the EncodeURL() that parameter with the /.

Attached is a sample of that.


Let me know if this fixes your issue.


Patrícia

RestAPI.oml

no i need to enter this in the field and find the data

Under this number, data about the person is stored, I need to pull it out. But he swears at the slash, how can you make him skip the slash

I have a lot of people in my database with such an identifier with a slash

Sorry, didn't understand what you're trying to achieve. 


Could you be more specific on what you're want to do and what are you doing at the moment?


I thought that you're trying to send the value '13:200:003:000:15/2:16' as an URL parameter and that caused the error because of the '/' character. If you encode that value, you'll no longer get that error.


Remember that a REST API is an HTTP request so a '/' character on a parameter will change the resource you are trying to reach (a problem that is fixed with the encoding).

@kan2332 , Do you get the error when saving the value? 

Try the  Substr and Index function  if you wish to ignore all characters from "/" in the string eg: Substr("13:200:003:000:15/2:16", 0, Index("13:200:003:000:15/2:16", "/"))

i need it to skip all characters

what do you mean by  "i need it to skip all characters", could you give an example?

If the CadastralNum is a URL parameter, perhaps try what @Patrícia Glória Ferreira has suggested. 

If  I understand what you are trying to do. I would,

Fix Error 400 - by using EncodeURL()  on  CadastralNum when calling GetPledgeListByCasandralNumber 

Skip all "/" - On GetPledgeListByCasandralNumber Replace(CadastralNum,"/","") or  ignore all characters from "/" by Substr(CadastralNum, 0, Index(CadastralNum, "/")) 


I need skip this characters
(@#$%^&*_+{}[]';:/?!~)

do you mean that you want to prevent those characters from being entered in the input text, something like implementing an input mask?

I need it to just skip these characters and output the data. Example:

I have several numbers in each of them data:

1) 13: 200: 003: 000: 15/2: 16


2) 25: 500: 001: 00 @ 0: 152: 16


3) 14: 700: 00 $$ 1: 000: 152: 16


I need it to ignore all characters and show data

Solution

try Regex_Replace with pattern "[\(@#$%^&*_+{}\[\]';:/?!~\)]" and replace all characters in the pattern with an empty string ("")

I've uploaded a simple app for you to play with. 

MySandpit.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.