ni.com is currently experiencing issues.
Support teams are actively working on the resolution.
ni.com is currently experiencing issues.
Support teams are actively working on the resolution.
01-15-2014 09:27 PM
I am using the REST Web Service to build an API for some VIs.
I want to do the following:
I was able to do number 1 above by calling the Set HTTP Response Code VI. However, when I do this I am not able to return data (the body is empty).
Is there a way to return data while also setting the response code to a non-OK response?
If not, then I have to always return "200-OK", even when errors occur, and include an error data structure in every transaction.
Solved! Go to Solution.
01-21-2014 06:01 PM
I spoke with my NI support person and it sounds like this same issue was opened in their issue tracking system back in April 2013. There may be a solution in the future, but for now this is how the REST service works in LabVIEW.
My work around will be to always return the error cluster; the client will look at the error cluster to determine if there was an error.
(Always returning the error cluster is not ideal as it makes for a larger payload and that it breaks the convention of using the HTTP response codes to convey an error.)
01-22-2014 09:59 AM
To close the loop on this one. If anyone is interested in tracking this Corrective Action Request, the number is 400778.
A work around to this issue is to use the Stream Output mode rather than the Terminal output mode. This will allow you to write a response and set the code.
KiraT
10-31-2018 04:11 AM
I was just about to give LabVIEW WebServices another chance with the development of production-use API, but it seems like issues such as this one and others are still there, making them clumsy to use and difficult to abide to the recognized REST paradigms.
This is quite disappointing in 2018, when the IOT is marching at fast pace towards HTTP-based APIs. NI should step in on this and give WebServices a serious polish.