fwrest-client-generator

Generate Protheus ADVPL/TLPP code consuming REST APIs via FWRest.

115|54|Updated May 25, 2026
One-click install
npx skills add https://github.com/totvs/engpro-advpl-tlpp-skills --skill fwrest-client-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fwrest-client-generator
Source: https://github.com/totvs/engpro-advpl-tlpp-skills/tree/main/skills/advpl-tlpp/fwrest-client-generator
Command: npx skills add https://github.com/totvs/engpro-advpl-tlpp-skills --skill fwrest-client-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves the problem of integrating Protheus/ADVPL/TLPP with external REST APIs by generating robust, production-ready client code using the FWRest HTTP client instead of ad-hoc or legacy HTTP calls.

Core Features & Use Cases

  • FWRest REST Client Generation: Produces end-to-end ADVPL/TLPP code to consume external APIs with GET, POST, PUT, and DELETE verbs using a consistent FWRest lifecycle (New → SetPath/params → headers → invoke → parse result).
  • Authentication & Header Construction: Supports No Auth, HTTP Basic, Bearer/JWT, API-key headers, and OAuth 2.0 patterns (including token fetching and caching guidance), with secure credential handling via GetMV.
  • Request/Response Robustness: Handles query/path parameters (including URI escaping), timeouts, SSL expectations via appserver.ini, status-code strategy (legacy success vs full 2xx), optional disabled internal status checking to read 4xx/5xx bodies, TLPP Try/Catch wrapping, and safe logging without leaking secrets.
  • Use Case: Replace legacy HTTPCGet/HTTPCPost/HTTPQuote logic with a standardized FWRest client for a third-party JSON API integration that must correctly interpret status codes and parse error bodies.

Quick Start

Ask the skill to generate TLPP/ADVPL code that consumes a third-party REST endpoint using FWRest with Bearer token authentication, sends a JSON POST payload, reads the response as JSON, and includes TLPP Try/Catch error handling plus HTTP status-aware logging.

Frequently Asked Questions about fwrest-client-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I consume a REST API in ADVPL using the FWRest client?

Generating FWRest client code in Protheus handles query and path parameters with URI escaping, sets configurable timeouts, and applies SSL considerations via appserver.ini to ensure secure external REST API communication.

How does FWRest handle OAuth2 and Bearer token authentication in Protheus?

FWRest manages HTTP status codes using SetChkStatus and SetLegacySuccess, allowing you to control whether full 2xx codes or legacy success modes are accepted. Disabling internal status checking lets you read and parse 4xx and 5xx error bodies.

Can I use TLPP try/catch patterns for HTTP error handling in Protheus?

Yes, you can use TLPP try/catch patterns for HTTP error handling in Protheus. Wrapping FWRest calls in TLPP try/catch blocks allows robust error interception, safe logging without leaking secrets, and inspection of GetHTTPCode, GetResult, and GetLastError.

What is the best way to replace legacy HTTPCGet and HTTPCPost logic with FWRest?

The best way to replace legacy HTTPCGet and HTTPCPost logic is generating a standardized FWRest client for third-party JSON API integration. This approach provides a consistent lifecycle for request construction, correct status code interpretation, and JSON response parsing.

Does FWRest require appserver.ini configuration for SSL REST API integration?

FWRest handles JSON serialization for REST API payloads in ADVPL/TLPP by converting ADVPL objects to JSON strings for POST and PUT request bodies, and parsing the JSON response string back into navigable ADVPL objects using GetResult.