Emil Odobasic · Sep 13, 2023 go to post

Thanks for the answer! We managed to make it work somehow! Appreciate the help! :)

Emil Odobasic · Sep 13, 2023 go to post

Hello Luis! I appreciate the post very much! I will look into this directly. Seems to be the way to go. Thank you very much! :)

Emil Odobasic · Sep 13, 2023 go to post

Another question for you Luis: Do you need to use Docker in order to implement the code in your post and everything else that is mentioned there? Or is it possible to freehand from scratch just by following what you have written? :)
Thanks beforehand!

Emil Odobasic · Oct 10, 2023 go to post

Hello Luis and thank you so much for your answer! 
I tried to change to:  return response.%JSONExport() instead of:  write response.%ToJSON()

But I still get the error in the service. I can't see what is wrong.

Emil Odobasic · Nov 29, 2023 go to post

Hello Enrico!

I will try your suggenstions!

Thank you very much once again! :)

Emil Odobasic · Jan 2, 2024 go to post

Hello Ashok! :) Thanks for your answer. I am still having trouble getting the value of the string that is being sent into my webservice. The key is testParam, but it doesn't seem to work as it is now with "Get". Do you have any tips on what to do instead? :)

Emil Odobasic · Jan 8, 2024 go to post

Hello! I have read it, and tried multiple things but nothing seems to work :( 
I have tried these already: 
set vProfile = %request.Get("profile")
set vProfile = $Get(%request.Data("profile"))
set vProfile = $Get(%request.MimeData("profile"))
and 
set vProfile = %request.GetMimeData("profile")

Emil Odobasic · Jan 8, 2024 go to post

"Profile" is one of the keys in the form. I have tried this: set vProfile = $Get(%request.Data("profile",1), but it only returned an empty value :(

Emil Odobasic · Jan 8, 2024 go to post

yes, I am 100% sure. Don't really know where it has gone wrong.
Double checked postman just to be sure.

Emil Odobasic · Jan 10, 2024 go to post

Hello! It is not an encoded form. :( You might be right about WRC being able to help out!

Emil Odobasic · Jan 12, 2024 go to post

Hello! :) The request that is being sent to my rest-service via postman has one key in the form which is "Profile". The Value of "Profile" is "TEST". But I cannot get my service to log "TEST". By attribute do you mean the Value of the key "Profile"? :) 

Emil Odobasic · Jan 12, 2024 go to post

Hello! :) Yes, I did manage to upload a file using similar code. What doesn't work is actually not being able to read strings that are sent via the form-data to my service. The Key that is being sent in the form-data, via postman, is "Profile" and the value of the key is "TEST". So far I can't manage to log the value "TEST". :(

Emil Odobasic · Jan 29, 2024 go to post

Okay! So what finally solved it was a discussion with the WRC support. 

Within the Postman request, and the form-data; Content-type was specified as text/plain on each part of the form. That is why %request.Data("profile") wouldn't work at first. The content of each part of the form gets sent into the REST-service as a stream.
With this said, instead I had to use this code which finally worked:

set profileStream = %request.GetMimeData("profile")
set vProfile = profileStream.Read()
However, one thing worth noting is that when I did not specify content-type for each part of the form-data, then the original code I used worked: 
set vProfile $Get(%request.Data("profile")) .

Thanks to WRC and everyone here who tried to help! :)

Emil Odobasic · Jan 29, 2024 go to post

Okay! So what finally solved it was a discussion with the WRC support. 

Within the Postman request, and the form-data; Content-type was specified as text/plain on each part of the form. That is why %request.Data("profile") wouldn't work at first. The content of each part of the form gets sent into the REST-service as a stream.
With this said, instead I had to use this code which finally worked:

set profileStream %request.GetMimeData("profile")
set vProfile profileStream.Read()

However, one thing worth noting is that when I did not specify content-type for each part of the form-data, then the original code I used worked: 
set vProfile $Get(%request.Data("profile")) .

Thanks to WRC and everyone here who tried to help! :)

Emil Odobasic · Feb 15, 2024 go to post

Hello!
The response from Robert worked for my purpose! But your solution sounded interesting aswell, I will try it out just for curiosity! :) Thanks for taking the time to respond! :)