Histórico da Página
Esta annotation deve ser utilizada quando for necessário desenvolver uma aplicação que responderá pelo método/verbo PATCH. Este método/verbo aplica modificações parciais a um recurso.Abaixo veremos exemplos de sua utilização:
Exemplo utilizando função e recebendo parâmetro via path param
@Patch("examples/function/patch/path/user/:user")
User Function examplesFunctionPatchPath()
Local cJson := ""
Local jPath
Local cBody := ""
jPath := JsonObject():New()
jPath := oRest:getPathParamsRequest()
cBody := oRest:getBodyRequest()
If (jPath <> Nil)
cJson := '[ { "description": "examplesFunctionPatchPath successfully executed, parameter received: ' + jPath['user'] + '" , "body received":"'+ cBody + '"} ]'
Endif
Return oRest:setResponse(cJson)
Exemplo utilizando função e recebendo parâmetro via query string
@Patch("examples/function/patch/query/user")
User Function examplesFunctionPatchQuery()
Local cJson := ""
Local cBody := ""
Local jQuery
jQuery := JsonObject():New()
jQuery := oRest:getQueryRequest()
cBody := oRest:getBodyRequest()
If (jQuery <> Nil)
cJson := '[ {"description": "examplesFunctionPatchQuery successfully executed, parameter received: ' + jQuery['user'] + '" , "body received":"'+ cBody + '"} ]'
Endif
Return oRest:setResponse(cJson)
Class classPatchExamples
Public Method New()
Public Method methodExamplePatchPath()
Public Method methodExamplePatchQuery()
EndClass
Method New() class classPatchExamples
Return self
@Patch("examples/class/patch/path/user/:user")
Method methodExamplesPatchPath() class classPatchExamples
Local cJson := ""
Local cBody := ""
Local jPath
jPath := JsonObject():New()
jPath := oRest:getPathParamsRequest()
cBody := oRest:getBodyRequest()
If (jPath <> Nil)
cJson := '[ {"description": "examplesMethodPatchPath successfully executed, parameter received: ' + jPath['user'] + '" , "body received":"'+ cBody + '"} ]'
Endif
Return oRest:setResponse(cJson)
@Patch("examples/class/patch/query/user")
Method methodExamplesPatchQuery() class classPatchExamples
Local cJson := ""
Local cBody := ""
Local jQuery
jQuery := JsonObject():New()
jQuery := oRest:getQueryRequest()
cBody := oRest:getBodyRequest()
If (jQuery <> Nil)
cJson := '[ {"description": "examplesMethodPatchQuery successfully executed, parameter received: ' + jQuery['user'] + '" , "body received":"'+ cBody + '"} ]'
Endif
Return oRest:setResponse(cJson)
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas