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 3.x - 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 point. HTTP_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 3.x - 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.

Syntax

Response = HTTP_Entry_Point_Services(RemainingURL)

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.

Parameters

ParameterDescription
RemainingURL

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.

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 3.x - HTTP_Service_Setup insert.

Setup Variables

VariablesDescription

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).

CurrentServiceHandler

The name of the currently running BASIC+ stored procedure.

  • No labels