Trying to use the CSV format

State,Success,Message
IDLE,True,Camera is idle

Hi all,
I’m trying to use the “CSV” method to control the camera and filter wheel.
I’m using C#
I’m taking baby steps at this point.
This works:
http://localhost:59590/csv/reply/SgGetDeviceStatus

I get back this:
State,Success,Message
IDLE,True,Camera is idle

Perfect!!!

BUT… I see in the document, that I may want to query the focuser, filter wheel, etc.

Here’s the request I’m supposed to do:
POST /csv/reply/SgGetDeviceStatus HTTP/1.1
Host: localhost
Content-Type: text/csv
Content-Length: length

Device
Camera

So, I think if I had an example of exactly the bytes I would need to send, I could then do the whole thing.
But nothing I try seems to work.
Here’s one of my attempts:
URLString = “http://localhost:59590/POST/csv/reply/SgGetDeviceStatus HTTP/1.1 \nHost: localhost \nContent-Type: text/csv\nContent-Length: 138\nDevice\nCamera\n”

I get back
404

Can anyone help me?

Thanks

Dan Gray
http://siderealtechnology.com

I would personally not use the CSV endpoint as it will want to download a document with each request. You’ll probably want to use JSON which will be substantially easier to deal with in C#.

Also the endpoint for that is:
http://localhost:59590/devicestatus/camera

There is also a JSON example in our Documentation:
http://www.mainsequencesoftware.com/Content/SGPHelp/JSONExample.html

Thanks,
Jared

Thanks Jared, really appreciate the help.
Ok, well, I didn’t want to install any helpers, I usually write all my own libraries. Also, I’m a really low level programmer, very good at banging bits, but the high level stuff confuses the heck out of me.

So, on your recommendation I tried to install restSharp using NuGet Package Manager.

I get this message.

Error Unable to resolve dependency ‘Microsoft.SourceLink.GitHub’. Source(s) used: ‘nuget.org’, ‘Microsoft and .NET’, ‘Microsoft Visual Studio Offline Packages’.

So I tried to install Microsoft SourceLink Common,

Got this message:

Severity Code Description Project File Line Suppression State

Error The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns=“http://schemas.microsoft.com/developer/msbuild/2003” to the element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\CSharp\SiTechCamera\SiTechCamera\packages\Microsoft.SourceLink.Common.1.0.0-beta2-18618-05\build\Microsoft.SourceLink.Common.props 0

Did some lookup looks like I need to upgrade from VS2015 to 2017

I’m trying that now.

But I tried a few more times, hoping to avoid all the libraries. So I tried this:

http://localhost:59590/json/reply/SgCaptureImage{“BinningMode”:1,“IsoMode”:0,“ExposureLength”:1,“Gain”:“Low”,“Speed”:“Normal”,“FrameType”:“Light”,“Path”:"C:\Temp",“UseSubframe”:false,“X”:0,“Y”:0,“Width”:0,“Height”:0}

I got this response:

{"ResponseStatus":{"ErrorCode":"NotImplementedException","Message":"The operation '%22,%22UseSubframe%22:false,%22X%22:0,%22Y%22:0,%22Width%22:0,%22Height%22:0%7D' does not exist for this service"}}
Could you or someone else take and exposure, and capture exactly what was sent and received? If so, I could be on my way without all the libraries.

I'm using the built in to C# WebClient. I just pass it a url as a text string, and I have a procedure that runs when download is complete.

Dan

Dan


Dan,
I think you’re misunderstanding the endpoints in our documentation, and this could be made better. For instance the image endpoint is:

http://localhost:59590/image

image