├── .gitattributes ├── API CUSTOM └── API PEDIDO DE VENDA │ └── fWsPedVenda.prw ├── API PADRAO └── API USER │ ├── fAlterarUsuario.prw │ └── fTesteAlterUsr.prw ├── Doc ├── Exemplo de consumo com HTTP Basic.doc └── O serviço Rest users do Protheus de criação de usuários utilizando Webservice REST.docx ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.apl linguist-language=xBase 2 | *.apw linguist-language=xBase 3 | 4 | *.ch linguist-language=xBase 5 | *.th linguist-language=xBase 6 | 7 | *.prg linguist-language=xBase 8 | *.prx linguist-language=xBase 9 | *.prw linguist-language=xBase 10 | 11 | *.tlpp linguist-language=xBase 12 | 13 | *.hb linguist-language=ini 14 | -------------------------------------------------------------------------------- /API CUSTOM/API PEDIDO DE VENDA/fWsPedVenda.prw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jerfweb/API-REST-PROTHEUS/4d6c605140920650d96ed7b73d0b5afef79f82f3/API CUSTOM/API PEDIDO DE VENDA/fWsPedVenda.prw -------------------------------------------------------------------------------- /API PADRAO/API USER/fAlterarUsuario.prw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jerfweb/API-REST-PROTHEUS/4d6c605140920650d96ed7b73d0b5afef79f82f3/API PADRAO/API USER/fAlterarUsuario.prw -------------------------------------------------------------------------------- /API PADRAO/API USER/fTesteAlterUsr.prw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jerfweb/API-REST-PROTHEUS/4d6c605140920650d96ed7b73d0b5afef79f82f3/API PADRAO/API USER/fTesteAlterUsr.prw -------------------------------------------------------------------------------- /Doc/Exemplo de consumo com HTTP Basic.doc: -------------------------------------------------------------------------------- 1 | Message-ID: <215314278.141975.1553283655896.JavaMail.root@tdn-prod-app01.sp01.local> 2 | Subject: Exported From Confluence 3 | MIME-Version: 1.0 4 | Content-Type: multipart/related; 5 | boundary="----=_Part_141974_2026468307.1553283655896" 6 | 7 | ------=_Part_141974_2026468307.1553283655896 8 | Content-Type: text/html; charset=UTF-8 9 | Content-Transfer-Encoding: quoted-printable 10 | Content-Location: file:///C:/exported.html 11 | 12 | 16 |
17 | 19 |Verifique se a chave SECURITY da se=C3=A7=C3=A3o Socket esta config= 240 | urado com valor 1 para testar o c=C3=B3digo abaixo
241 |Os m=C3=A9todos Put e Delete da classe= 249 | FWRest estar=C3=A3o dispon=C3=ADveis na Lib label 28012015
251 |#include = 257 | "totvs.ch" 258 | 259 | User Function restSample() 260 | Local oRestClient :=3D FWRest():New("http://localhost:8080") 261 | Local aHeader :=3D {"tenantId: 99,01"} 262 | 263 | // inclui o campo Authorization no formato <usuario>:<senha> na= 264 | base64 265 | Aadd(aHeader, "Authorization: Basic " + Encode64("admin:123456")) 266 | 267 | // chamada da classe exemplo de REST com retorno de lista=20 268 | oRestClient:setPath("/rest/sample?startIndex=3D2&count=3D10") 269 | If oRestClient:Get(aHeader) 270 | ConOut("GET", oRestClient:GetResult()) 271 | Else 272 | ConOut("GET", oRestClient:GetLastError()) 273 | EndIf 274 | 275 | // chamada da classe exemplo de REST para opera=C3=A7=C3=B5es CRUD 276 | oRestClient:setPath("/rest/sample/1") 277 | If oRestClient:Get(aHeader) 278 | ConOut("GET", oRestClient:GetResult()) 279 | Else 280 | ConOut("GET", oRestClient:GetLastError()) 281 | EndIf 282 | 283 | 284 | // define o conte=C3=BAdo do body 285 | oRestClient:SetPostParams("body") 286 | 287 | If oRestClient:Post(aHeader) 288 | ConOut("POST", oRestClient:GetResult()) 289 | Else 290 | ConOut("POST", oRestClient:GetLastError()) 291 | EndIf 292 | 293 | 294 | // para os m=C3=A9todos PUT e DELETE o conte=C3=BAdo body =C3=A9 enviado po= 295 | r parametro 296 | If oRestClient:Put(aHeader, "body") 297 | ConOut("PUT", oRestClient:GetResult()) 298 | Else 299 | ConOut("PUT", oRestClient:GetLastError()) 300 | EndIf 301 | 302 | If oRestClient:Delete(aHeader, "body") 303 | ConOut("DELETE", oRestClient:GetResult()) 304 | Else 305 | ConOut("DELETE", oRestClient:GetLastError()) 306 | EndIf 307 | Return=20 308 |
313 | 314 |
Criando uma c= 315 | lasse REST
316 |317 |
318 |
319 |