Usina BRAdvPL Guide
Sign in
← All topics
COMMANDUnder review

WSRESTFUL

WSRESTFUL cName DESCRIPTION cDescription [SECURITY cRoutine] [SSL ONLY]

Declares a REST server class in Protheus.

WSRESTFULAdvPL
01 · OVERVIEW

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

02 · SYNTAX

Syntax

WSRESTFUL cName DESCRIPTION cDescription [SECURITY cRoutine] [SSL ONLY]
03 · PRACTICAL EXAMPLE

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.
Expected result

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.

BEST PRACTICES
  • 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.

Related content

REFERENCES
  1. TOTVS. WSRESTFUL. SECURITY, SSL e encerramento. Accessed on 2026-10-28.
  2. TOTVS. Criando uma classe REST. Accessed on 2026-10-28.
  3. Atilio. dan-atilio/AdvPL. Maratona de Exemplos/Exemplo_535_Classe_WsRestFul.prw. Arquivo completo analisado; adaptação editorial. Accessed on 2026-10-28.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha