Skip to content

Instantly share code, notes, and snippets.

@amendoncabh
Forked from vitorebatista/tstwsrest.prw
Created April 6, 2021 12:09
Show Gist options
  • Save amendoncabh/089eff68152f62b98eec326ef6009294 to your computer and use it in GitHub Desktop.
Save amendoncabh/089eff68152f62b98eec326ef6009294 to your computer and use it in GitHub Desktop.
Exemplo webservice REST ADVPL
#include "PROTHEUS.ch"
#include "RESTFUL.ch"
#xtranslate @{Header <(cName)>} => ::GetHeader( <(cName)> )
#xtranslate @{Param <n>} => ::aURLParms\[ <n> \]
#xtranslate @{EndRoute} => EndCase
#xtranslate @{Route} => Do Case
#xtranslate @{When <path>} => Case NGIsRoute( ::aURLParms, <path> )
#xtranslate @{Default} => Otherwise
WsRestful tstwsrest Description "WebService REST para testes"
WsMethod GET Description "Sincronização de dados via GET" WsSyntax "/GET/{method}"
End WsRestful
WsMethod GET WsService tstwsrest
::SetContentType( 'application/json' )
@{Route}
@{When '/users'}
::SetResponse('')
@{EndRoute}
Return .T.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment