API Documentation
This section of the documentation is meant for other developers who are attempting to interface with Sequence Generator Pro in a programmatic way. If you are not a developer, you can skip this section.
Sequence Generator Pro offers a modest API to external applications that want to use it in order to capture image data (for external analysis) or to manipulate other equipment connected in SGPro. In an effort to be device and protocol agnostic, SGPro uses an HTTP based API. This means that you can make calls using SOAP, JSON, XML, JSV or CSV. Whatever your comfortable with... Almost every platform you use has a client library to help you use API calls using one of these. In terms of non-SOAP calls you can think of the API calls at REST if it makes it easier for you. That said, the SgPro API does not operate around data models and is not technically RESTful, but it does use the same basic set of protocols for communication.
To get more information about the API:
- Start Sequence Generator Pro (version 2.3 or higher)
- Using your favorite browser, navigate to http://localhost:59590/metadata
When you do so, you will see am API documentation page that looks similar to:
This page outlines API calls available in SGPro. Here we will go through an example of how to interpret docs for a JSON call (others are similar).
First, go ahead and click the "JSON" link for one of the simpler calls "SgGetDeviceStatus". You should see something similar to:
At the top, you will see a brief description of what the call does... It is important to note that this is the area that will describe the meaning of return / response values. Below it you will see a set of supported HTTP verbs. Some calls support all HTTP verbs and some, if they are more complex, use only "Post". For instance, the call to capture an image looks like:
Below that you will see an input parameter listing. This one has only one value named "Device". As you can see in the "verb" section, there is a URI labeled /devicestatus/{Device}. This is meant to indicate that you substitute {Device} with the name of a real device like "Camera". For instance, the URI /devicestatus/Camera will return the status of the camera.
The very bottom block shows the structure of the response type (of course JSON in this case). Keep in mind that this is not RESTful. You can receive a response code of "200 OK" and still have a failure. Of course, if you do receive a response code other than 200, it does indicate a failure as well. The type of response object for various calls is dependent on the call itself. That said, all response object will return a boolean value for "Success" and an associated "Message" (string). Specific to this call you will see an additional "State" property. As indicated in the call's description, this can contain "IDLE", "CAPTURING", "BUSY", "MOVING", "DISCONNECTED" or "PARKED" (assuming Success is True).
Further Help
In order to get further help please feel free to join our forum here http://forum.mainsequencesoftware.com or contact our "info" address located on the website support page. Lastly, we have provided an example of taking an image with the camera here. This example happens to be from a C# console application and uses the RestSharp and the NewtonSoft JSON helper libraries.