I have one expose post rest api which has a single input as binary data datatype which is accepted in body. And the uploaded binary file will always be JSON.
Now I want to check if the file I'm accepting should not be null or empty. So, I'm using two binary data actions
Just to let you know - as its service module I can't use js or client actions.
How can I do file validation - file size should be under 30 MB and the file should not be null or empty.
Hi,
May I know what are the expected binary values?
Regards,Wasimkhan S
Hi @Wasim Khan,
Expected binary values is JSON data.
For eg -
{
"name": "FarmTest",
"countrycode": "us",
"type": "user"
}
You can receive JSON data as an input "Text". or can you send the sample binary data you are passing.
Regards,
Wasimkhan S
I have to recieve it as binary data only. Attaching dummy test file.
I have to recieve it as binary data only. Can't attach json file.
JSON content -
"type": "FeatureCollection",
"features": [
"type": "Feature",
"properties": {
"Name": "FarmTest"
},
"geometry": {
"coordinates": [
[
29.1832273802396,
9.900000362975291
],
9.892567362336791
29.191100706171625,
]
"type": "Polygon"
"id": 0
Hi Bhanu,
is it possible to share your test file?
Hi @vignesh S,
Can't attach JSON file.
Hi, according to the example you are providing your do not get a binary data in the body, but a multipart form request. You have to deal with the multipart first and you can use this component by @Kilian Hekhuis to parse the multipart body https://www.outsystems.com/forge/component-overview/4026/multipart-form-data-o11.
Stefan
Hi @Stefan Weber,
Thanks for your reply I'll check the links you provided.
Tbh parsing a received multipart/form-data wasn't written by me 😄