Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Sometimes getting a taste of success is all that's need needed to charge ahead and make technology create technological magic. Therefore, before diving in and creating new APIs, let's make sure that the default APIs are responding correctly to incoming requests.

...

The 103-966 OpenInsight OEngineServer Configuration.pdf document provides thorough instructions for installing the Engine Server as a true Windows service as well as how to launch . It also provides instructions for launching it from a command prompt (aka "debug" mode). We recommend starting out by running the Engine Server from a command prompt since developers will need access to the OpenInsight Debugger when writing and troubleshooting their web APIs.

It is possible to test the SRP HTTP Framework without having to go through the effort of creating any APIs. This will not guarantee that all possible configuration details have been properly updated, but at this point we just want to make sure that HTTP requests are getting received by the SRP HTTP Framework and a proper response is being sent back.

The quickest way to run a test is to enter your API URL into a browser and submit the request. For instance, if your Home URL is https://api.mysite.com and your API URL is /v1, then enter the following into your browser's address bar:

https://api.mysite.com/v1

This should immediately make contact with the OECGI and then OpenEngine. If you are running the Engine Server in the command line you will see an instance of OpenEngine running on the desktop. Otherwise, if you are running the Engine Server as a service, you will probably not see any OpenEngine activity.

The clearest indicator that the SRP HTTP Framework system is running is based on the response you get. If you enabled authentication in the HTTP Framework Setup form, the response should appear like this:

{
   "URL" : "https://api.mysite.com/v1/",
   "method" : "GET",
   "phrase" : "Unauthorized (RFC 7235)",
   "status" : 401
}

If authentication is disabled, the response should appear like this:

{
"_links": {
"item": [
{
"href": "https://api.mysite.com/v1/contacts",
"title": "contacts"
},
{
"href": "https://api.mysite.com/v1/version",
"title": "version"
}
],
"self": {
"href": "https://api.mysite.com/v1/"
}
}
}

Here's an example of what this should look like if everything is configured correctly:

Image Added

Knocking on the Front Door

If everything else is in good order then you are ready to run your first test. This can be done from a web browser, but unless you disabled authentication, you are likely only going to see a default 401 (i.e., unauthorized) response like this:

Image AddedHowever, this is actually good news! This confirms that the API request was received properly by the SRP HTTP Framework but it was rejected due to insufficient credentials. (Note: older browsers such as Internet Explorer do not display the JSON response as plain text in the window as seen above. Instead, by default they will attempt to download the JSON as a file.)

We recommend that a good API test utility be used. This is critical for providing credentials, testing other HTTP methods (e.g., POST, PUT, PATCH, and DELETE), and sending up content for the API to process. Postman is a very popular GUI tool that is available on multiple platforms. It has a free license which will be sufficient for all your testing needs. There are other options such a cURL and various browser plug-ins. Here's what a test of the same endpoint looks like with our pre-installed "test" user credentials:

Image AddedAgain, if you see either of the two responses this means success! You are ready to write your own RESTful APIsEither of the above responses indicates that the API entry point was reached and processed accordingly. Congratulations! You are now ready to start building your own RESTful web services.