Trying to take an image via json


Hi all,
I upgraded my visual Studio to 2017, and was able to install RestSharp, and Newtonsoft.Json via NuGet.

I’m still trying to take an image, via localhost:59590.
In the example, it’s not clear to me what uriBase is.
I was thinking it would be “http://localhost:59590/json/reply/
is that correct?

I’m not getting a good result.
My img.
My result is:
“Invalid image directory! Value cannot be null.\r\nParameter name: path”,“Receipt”:“00000000000000000000000000000000”}"|string|

But my image path is:
img.Path = “C:\ProgramData\SiTechSiTechCamera\”

Here’s a link to a screenshot of my debugger:
Thanks anybody that has any ideas…

Dan Gray


Did you see our example in our help file:

Base URL is: http://localhost:59590 (I can’t recall if the clients wants a trailing / or not)

you’ll notice that it appends image:
request.Resource = uriBase + “image”;

SgCaptureImage is not a valid endpoint.



Hi Jared,
Thanks for your response. I’m still having trouble.

I’ve tried everything I can think of, I was wondering if you could take a look at the request and the response in the following image link, and see if you can see what’s wrong.
The message is “Invalid Image Directory! Value cannot be null.”
But you can see the Path. in the parameters, I have it set to “C:\Temp\”

In the code snippet you provided, there’s a class:
public class SgGenericResponse
public bool Success { get; set; }
public string Message { get; set; }
But I need the class
SgImageResponse, it’s not shown.
Thanks again,
Dan Gray


Does C:\Temp exist?

The response is in the API Documentation for that request:




Thanks again Jared.
I was using SGP (version
So I had the thought to check the versions, and I found that is not the latest.
I upgraded to the latest non-beta, and I was able to take images.
Another issue, in the example, the class SgImage, was using an int for ExposureLength, not a float.
That wasn’t the problem though, it just meant that I couldn’t use a fractional exposure time.

As standard practice, I always use modifier “private” or “internal”, I only use “public” whenever it’s something that needs to be accessed outside of the software.
Apparently, RestSharp accesses the variables directly, so they need to be public, on the following classes:

Oh, also, there is no class in the example named SgCaptureImageResponse, but I found someone else had made there own.
Here it is:
public class SgCaptureImageResponse
public bool Success { get; set; }
public string Message { get; set; }
public Guid Receipt { get; set; }

Thanks again Jared for all your help,

Dan Gray