├── .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 | Exemplo de consumo com HTTP Basic 20 | 34 | 230 | 231 | 232 |

Exemplo de consumo com HTTP Basic

233 |
234 |
236 | 238 |
239 |

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 |
242 |
243 |
245 | 247 |
248 |

Os m=C3=A9todos Put e Delete da classe= 249 | FWRest estar=C3=A3o dispon=C3=ADveis na Lib label 28012015

251 |
252 |
253 |
254 |
=20 255 |
#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 |
309 |
310 |

 Veja tamb=C3= 311 | =A9m

312 |

 

313 |

Encode64

314 |

Criando uma c= 315 | lasse REST

316 |

 

317 |

 

318 |

 

319 |
320 | 321 | 322 | ------=_Part_141974_2026468307.1553283655896-- 323 | -------------------------------------------------------------------------------- /Doc/O serviço Rest users do Protheus de criação de usuários utilizando Webservice REST.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jerfweb/API-REST-PROTHEUS/4d6c605140920650d96ed7b73d0b5afef79f82f3/Doc/O serviço Rest users do Protheus de criação de usuários utilizando Webservice REST.docx -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Jerfferson Silva 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # API-REST-PROTHEUS 2 | 3 | [![licence badge]][licence] 4 | [![stars badge]][stars] 5 | [![forks badge]][forks] 6 | [![issues badge]][issues] 7 | 8 | [licence badge]:https://img.shields.io/github/license/jerfweb/api-rest-protheus 9 | [stars badge]:https://img.shields.io/github/stars/jerfweb/API-REST-PROTHEUS.svg 10 | [forks badge]:https://img.shields.io/github/forks/jerfweb/API-REST-PROTHEUS.svg 11 | [issues badge]:https://img.shields.io/github/issues/jerfweb/API-REST-PROTHEUS.svg 12 | 13 | [licence]:https://github.com/jerfweb/API-REST-PROTHEUS/blob/master/LICENSE 14 | [stars]:https://github.com/jerfweb/API-REST-PROTHEUS/stargazers 15 | [forks]:https://github.com/jerfweb/API-REST-PROTHEUS/network 16 | [issues]:https://github.com/jerfweb/API-REST-PROTHEUS/issues 17 | 18 | Exemplos de utilização das API's Rest do ERP Protheus. 19 | 20 | ## API PADRÃO 21 | 22 | - ### API USERS 23 | API para informações de usuário do ERP Protheus. 24 | No exemplo, foi criada uma rotina que recebe o código do usuário e a operação à ser executada como parâmetro, realiza a operação e obtêm o retorno do serviço no formato JSON. Foram implementadas algumas validações básicas para garantir a execução. 25 | 26 | #### Documentação disponível no site da TOTVS: 27 | - [O serviço Rest users do Protheus de criação de usuários utilizando Webservice REST.](http://tdn.totvs.com/pages/releaseview.action?pageId=274327398) 28 | - [Exemplo de consumo com HTTP Basic.](http://tdn.totvs.com/display/framework/Exemplo+de+consumo+com+HTTP+Basic) 29 | 30 | - ### API TOKEN 31 | Implementação do OAuth 2.0 (https://tools.ietf.org/html/rfc6749) para requisição de token para acesso aos sistema TOTVS. É altamente recomendado o uso de segurança SSL. 32 | 33 | #### Documentação disponível no site da TOTVS e sites de apoio: 34 | - [Detalhamento de consumo da API TOKEN](https://api.totvs.com.br/apidetails/Token_v1_000.json) 35 | - [ADVPL + REACT – Parte 03 | Segurança e API de Login + BÔNUS.](https://augustopontin.com.br/programacao/advpl-react-parte-03-seguranca-e-api-de-login-bonus/) 36 | >Documentação desenvolvida por [Augusto Pontin](https://augustopontin.com.br/author/augusto-bsinfogmail-com/ "Posts de Augusto Pontin") 24 de abril de 2020 37 | 38 | ## API CUSTOMIZADAS 39 | 40 | - ### API de manutenção de pedidos de venda 41 | API para manutenção de pedidos de venda utilizando o Executo de MATA410, viabilizando a realização das validações desenvolvidos para efetuar o processo. 42 | 43 | 44 | 45 | Qualquer dúvida/sugestão, por favor, entre em contato através do e-mail [jerfweb@gmail.com](mailto:jerfweb@gmail.com). 46 | --------------------------------------------------------------------------------