WSRESTFUL
WSRESTFUL cName DESCRIPTION cDescription [SECURITY cRoutine] [SSL ONLY]Declares a REST server class in Protheus.
Overview
WSRESTFUL/END WSRESTFUL delimit a declaration under RESTFUL.CH. Methods need both declaration and implementation plus compatible server configuration. SECURITY associates a routine with privilege checks; SSL ONLY restricts transport under effective configuration. Neither replaces resource authorization or data validation. This teaching service performs no table access and requires authentication, privilege and TLS policy before exposure. (Sources: refs. 1–3.)
Syntax
WSRESTFUL cName DESCRIPTION cDescription [SECURITY cRoutine] [SSL ONLY]Commented example
#Include "TOTVS.CH"
#Include "RESTFUL.CH"
// Teaching example; configure authentication, privileges and TLS before exposure.
WSRESTFUL ED713 DESCRIPTION "Editorial example" SSL ONLY
WSMETHOD GET STATUS DESCRIPTION "Status" PATH "status"
END WSRESTFUL
WSMETHOD GET STATUS WSSERVICE ED713
Self:SetContentType("application/json")
Self:SetResponse('{"status":"ok"}')
Return .T.Proposes a fixed JSON response on a validated environment; proves neither configuration, publication nor an actual request. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Verify publication/restart lifecycle for the implementation. Do not copy NOTENANT or weaken privileges to make the sample work.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.