Versions Compared

Key

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

All systems need an entry, or starting, point. For character based system this is often a command prompt or text-based menu. For GUI systems this is often a form. For user accessible websites this is the home page. Application APIs, likewise, have an entry point. One could argue that HTTP_MCP is the entry point for the SRP HTTP Framework, but this is more accurately the Controller. As such it behaves as a conduit into the entry pointHTTP_Entry_Point_Services is the default entry point for the SRP HTTP Framework. This can be renamed but this change will also need to be updated in HTTP_Service_Setup and all routines that include this insert will need to be recompiled. HTTP_Entry_Point_Services is best treated as a top-level menu. This is where the main features of the API are accessed from. Then the various application specific services are created and operate like drop down menu items, either serving as access points to other services or acting as end point services themselves.

Sample web service (API) to handle API entry point requests If an unexpected error occurred with a request, the HTTP_MCP controller will be called again with the ProcErr argument populated. The nature of the error (usually a runtime error) will be contained in the ProcErr argument. This routine is a template for generating a response so the caller will receive a well formatted reply.

Syntax

Code Block
Response = HTTP_ProcErr_Services(RemainingURLProcErr)

Returns

The meaning of the response value depends on the HTTP request. Responses are strictly for debugging purposes only since web service routines should be using the services in the HTTP_Service routine.N/A

Parameters

ParameterDescription
RemaiiningURLProcErr

The remaining portion of the URL that follows the URL that launched this current service. If this is empty, it implies that the URL has reached the end point. See the remarks section below. Required.

Remarks

All API URLs will begin with the entry point web service. By default this is HTTP_Entry_Point_Services, but this is officially configured in the Entry Point Service attribute in the SRP_HTTP_FRAMEWORK_SETUP configuration record.

Because the entry point web service will always be accessed (which implies that the request was properly authenticated), this is also where global response headers are to be set.

 Web services are designed to process HTTP requests. In order to do this properly, they need to have access to specific information such as the HTTP method, entry point URL, and end point, URL. These commonly needed data points are assigned to several variables in the HTTP_Service_Setup insert.

Setup Variables

...

APIURL

...

The base URL for the API entry point (e.g., api.mysite.com/v1).

...

FullEndPointURL

...

The URL submitted by the client.

...

HTTPMethod

...

The HTTP Method (Verb) submitted by the client (e.g., GET, POST, etc.)

...

SelfURL

...

The URL path representing the current service.

...

NextSegment

...

The URL segment immediately following the SelfURL (if any). This could contain the name of the next service or it could contain the Item ID for the current service (aka resource).

procedural error data being passed in from the OEngineServer. Unless otherwise changed, the only reason this should be called is if there was a runtime error in one of the stored procedures that was called by the initial request.

Remarks

HTTP_ProcErr_Services is not like other HTTP services because it is not designed to process a Remaining URL. Therefore, there is no HTTP_SERVICE_SETUP insert nor is there the normal HTTP method checks

...

CurrentServiceHandler

...

.