Thanks for the answer! We managed to make it work somehow! Appreciate the help! :)
- Log in to post comments
Thanks for the answer! We managed to make it work somehow! Appreciate the help! :)
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! :)
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!
Thanks alot for the help! :)
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.
I will try it! Thank you so much for the help! :)
It works! Thank you very much for the help! :)
Hello Enrico!
I will try your suggenstions!
Thank you very much once again! :)
Thanks alot for the help! :)
Yes! This worked perfectly! Thank you so much for the help! :)
It worked great! Thanks alot for the help! :)
I will look into that, thank you! :)
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? :)
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")
Hello! Yes I tried that aswell. Still returns an empty value :(
"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 :(
yes, I am 100% sure. Don't really know where it has gone wrong.
Double checked postman just to be sure.
Hello! My class extends %CSP.REST :)
It says that %request.ContentType is "multipart/form-data"
It says that %request.ContentType is "multipart/form-data"
Hello! It still does not seem to retrieve anything :(. Just an empty string
But thanks alot for the code example, I really appreciate it! :)
Hello! It is not an encoded form. :( You might be right about WRC being able to help out!
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"? :)
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". :(
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! :)
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! :)
Hello!
Thanks alot! It worked flawlessly! :)
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! :)
Hello!
Thanks for the reply! I got it to work finally with the help of WRC! :)