Histórico da Página
Esta annotation deve ser utilizada quando for necessário desenvolver uma aplicação que responderá pelo método/verbo DELETE. Este método/verbo deleta o recurso especificado.Abaixo veremos exemplos de sua utilização:
Exemplo utilizando função e recebendo parâmetro via path param
/* --------------------------------------------- */
@Delete("examples/function/delete/path/user/:user")
User Function examplesFunctionDeletePath()
Local cJson := ""
Local jPath
jPath := JsonObject():New()
jPath := oRest:getPathParamsRequest()
If (jPath <> Nil)
cJson := '[ { "description": "examplesFunctionDeletePath successfully executed, parameter received: ' + jPath['user'] +'"} ]'
Endif
Return oRest:setResponse(cJson)
Exemplo utilizando função recebendo parâmetro via query string
/* --------------------------------------------- */
@Delete("examples/function/delete/query/user")
User Function examplesFunctionDeleteQuery()
Local cJson := ""
Local jQuery
jQuery := JsonObject():New()
jQuery := oRest:getQueryRequest()
If (jQuery <> Nil)
cJson := '[ {"description": "examplesFunctionDeleteQuery successfully executed, parameter received: ' + jQuery['user'] + '"} ]'
Endif
Return oRest:setResponse(cJson)
Class classDeleteExamples
Public Method New()
@Delete("examples/class/delete/path/user/:user")
Public Method methodExamplesDeletePath()
@Delete("examples/class/delete/query/user")
Public Method methodExamplesDeleteQuery()
EndClass
Method New() class classDeleteExamples
Return self
/* --------------------------------------------- *
...
/
...
Method methodExamplesDeletePath() class classDeleteExamples
Local cJson := ""
Local jPath
jPath := JsonObject():New()
jPath := oRest:getPathParamsRequest()
If (jPath <> Nil)
cJson := '[ {"description": "methodExamplesDeletePath successfully executed, parameter received: ' + jPath['user'] + '"} ]'
Endif
Return oRest:setResponse(cJson)
/* --------------------------------------------- */
...
Method methodExamplesDeleteQuery() class classDeleteExamples
Local cJson := ""
Local jQuery
jQuery := JsonObject():New()
jQuery := oRest:getQueryRequest()
If (jQuery <> Nil)
cJson := '[ {"description": "methodExamplesDeleteQuery successfully executed, parameter received: ' + jQuery['user'] + '"} ]'
Endif
Return oRest:setResponse(cJson)
Incluir Página | ||||
---|---|---|---|---|
|
Visão Geral
Import HTML Content
Conteúdo das Ferramentas
Tarefas