How to resolve this error?


I’m facing an issue in displaying the result.
Solution.RESTHOST.Helloworld.SetValue: Object reference not set to an instance of object.

I could set the Target of SetValue as $.Result.Response200 instead of $.Result.Data.Response200. I want to set the value as $.Result.Data.Response200 for the hello world program. I’m not sure why Data is not listed in the target.

I just played with other target values to see what is wrong in the above target value. When I set the target as “$.Result.HttpContext.StatusCode”, I got an error saying ‘Error converting value “Hello World” to type Int32’. This means it was able to get the input value but wasn’t able to convert it to Int32. This also means Result is not NULL.

Can you please help me to resolve this.

Hi Shirley_V,

Welcome to the Linx Community!

With regards to your first error, the document you are using as your reference was written for Linx 5. When they built Linx 6, they had a look at the “Data” part and decided it is unnecessary as the extra word does not add value. The Object reference error you get is because you need to set the Base of the return “$.Result” and not “$.Result.Response200” directly.

With regards to your second question, when you look at HTTP calls in general, an HTTP Status code is that number that a server returns to tell the consumer what happened. For instance a normal call would get something back like a 200. If the page was not found, you would get back a 404. If there was an error in the input fields, it’s a 500. So there’s a lot of codes that you can return, (in the above question you are returning Response200, which means its the response the consumer would read for a StatusCode of 200. So it will always be a number and never a String.

Best regards,

Our Design expert made an update to the document. You can have a look here: RESTHost - Get Started - Hello World!.