HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/web/secure/itpplates/person - Copy (2).asp
<%Option Explicit%>
<!--#include file="dbfunctions.asp"-->
<!--#include file="jsonObject.class.asp" -->

<html>
<head>
</head>
<body>
<h1>REST API Test</h1>
<%

Dim oJSONResponse ' used to hold the return JSONobject 
Dim oJSONRequest ' used to hold the request JSON


DebugOn
SetDebugLogTypeToFile
WebDebugLog

Response.ContentType = "application/json"

API_Run


Sub API_Run
  Dim LResult

  ' instantiate the class
  Set oJSONResponse = New JSONobject
  Set oJSONRequest = New JSONobject
  
  'oJSONRequest.debug = True
  'oJSONResponse.debug = True

  ' add default properties
  oJSONResponse.Add "status", 400
  oJSONResponse.Add "message", "Unknown error"
 
  On Error Resume Next ' start the error handling
  
  LResult = API_ReadRequest ' read request into object  
  If Err.Number <> 0 Then LResult = Err.Description
  
  If LResult = "" Then ' if no error then continue
    LResult = API_Authenticate ' check API key etc
    If Err.Number <> 0 Then LResult = Err.Description
    If LResult = "" Then
      LResult = API_ProcessRequest ' process the request
      If Err.Number <> 0 Then LResult = Err.Description
    End If
  End If
  
  On Error GoTo 0 ' cancel the error handling   
  
  ' if no error then change status code to 200
  If LResult = "" Then
    oJSONResponse.Change "status", 200  
  End If
  oJSONResponse.Change "message", LResult
  
  ' write the response
  oJSONResponse.Write()
  
  ' log the response
  API_Log "Response", oJSONResponse.Serialize
  
  ' free the object created earlier, might not be necessary
  Set oJSONResponse = Nothing
  Set oJSONRequest = Nothing
End Sub


%>
</body>
</html>