Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

#include "tlpp-core.th"
#include "tlpp-rest.th"

Class classGetExamples

   Public Method New()

   @Get("examples/class/get/path/user/:user")
   Public Method metodExamplesGetPath()

   @Get("examples/class/get/query/user")
   Public Method metodExamplesGetQuery()

EndClass

Method New() class classGetExamples

Return self

/* --------------------------------------- */
@Get("examples/class/get/path/user/:user")
Method methodExamplesGetPath() class classGetExamples

   Local cJson := ""
   Local jPath

   jPath := JsonObject():New()
   jPath := oRest:getPathParamsRequest()

   If (jPath <> Nil)
       cJson := '[ {"description": "methodExamplesGetPath successfully executed, parameter received: ' + jPath['user'] + '"} ]'
   Endif
Return oRest:setResponse(cJson)

/* --------------------------------------- */
@Get("examples/class/get/query/user")
Method methodExamplesGetQuery() class classGetExamples
   Local cJson := ""
   Local jQuery

   jQuery := JsonObject():New()
   jQuery := oRest:getQueryRequest()

   If (jQuery <> Nil)
       cJson := '[ {"description": "methodExamplesGetQuery successfully executed, parameter received: ' + jQuery['user'] + '"} ]'
   Endif
Return oRest:setResponse(cJson)