40
Views
20
Comments
Unable to send [] in form-data of my multipart API method
Application Type
Mobile, Reactive
Service Studio Version
11.54.34 (Build 62959)
Platform Version
11.24.0 (Build 41209)

I am unable to parse the [ character or the ] character in my API call, here's an example
I tried to add the double quotes to ensure that it is passed a string, but without the double quotes it just gets hung and doesnt proceed further in testing even.To give a background I already tried to convert the parameter into text make it manually and then parse it as a string, example:
I have a very tight deadline need help ASAP




2026-02-26 15-00-54
npinto
 
MVP

Hi Faizan,

Did you test your request using Postman, i.e.? And see if you get the same error?

The API specification tells you that you need to send the [] in each field to filer?


Regards,

Nelson

2023-03-03 11-03-26
Faizan Ul Haq

Postman brings the proper results :

2026-02-26 15-00-54
npinto
 
MVP

Can you please attach you OML, just to check if something can be wrong, please?

Thanks

2023-03-03 11-03-26
Faizan Ul Haq

Unfortunately due to policy I can't share the OML

2023-11-22 10-51-50
Jozy Sohail

hi faizan,

what is the exact error that you are getting in outsystems?


2023-03-03 11-03-26
Faizan Ul Haq

If I test it it says "Testing..." and just hangs,
If I click finish to complete it without testing it it doesnt create the API

2023-11-22 10-51-50
Jozy Sohail

Are you providing a proper structure in the response body?

try copying the response from postman and pasting it in the outsystems.

Thanks

2023-03-03 11-03-26
Faizan Ul Haq

I've copied what was in payload when monitoring network of postman to use as structure in outsystems, basically I think it is what you meant.

2026-02-26 15-00-54
npinto
 
MVP

Faizan,

Without a proper use case and/or example it is difficult to analyse which can be the issue.

However, did you try create the consume REST API manually instead of using the test approach?

Additionally, why do you need that your request format must be multipart? 

2023-03-03 11-03-26
Faizan Ul Haq

When creating manually it works but retrives all data, meaning it overlooked the query that had [] and just gave all the data in the system as response. 
The test approach as you said is the one that fails.

2026-02-26 15-00-54
npinto
 
MVP

But when you test in Postam with the filter logic, are you getting the right data?

In that case, can you check in the OnBeforeRequest (RequestText) how the body is being sent to the external API.

Let me know which is the value that you are getting in the RequestText field.

2023-03-03 11-03-26
Faizan Ul Haq
2023-03-03 11-03-26
Faizan Ul Haq

This is what I got, one thing I noticed was the name of the field was supposed to be field[0] and not "=?utf-8?B?4oCcZmlsdGVyTG9naWPigJ0=?="::

2023-03-03 11-03-26
Faizan Ul Haq

Although it seems fine in request part, is this something that is causing the problem ?


2026-02-26 15-00-54
npinto
 
MVP

Can you debug your OutSystems code, please?

At OnAfterResponse, can you add a breakpoint at the "start" and check which is the value of ResponseText or StatusLine.

2026-02-26 15-00-54
npinto
 
MVP

Additionally, at OnBeforeRequest, can you check the RequestParts when debugging it.

2018-06-05 16-54-03
Maria da Graça Peixoto

Hi! 

Have you tried to replace the brackets by  their code:

replace [   by       %5B    

replace ]   by      %5D


Just an idea

Graça

2023-03-03 11-03-26
Faizan Ul Haq

Yep, done that also tried EncodeUrl() and EncodeSql() just in case if I missed something, when I manually created the API it works but I am unable to query it since [] is not passing in outsystems.

2026-02-26 15-00-54
npinto
 
MVP

Faizan,

Which is the error message presented in Service Center?

Did you try to see which error you are getting in OnAfterResponse, in the StatusLine and/or ResponseText?

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