Versões comparadas

Chave

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

Índice:


       

Índice
exclude.*ndice:

Objetivo


Apresentar como utilizar o serviço RestProcess.

Requisitos


Nota
titleVersão

 Disponível à partir da versão 12.1.21 da linha RM.

Linha de Software
Versão
Data de Liberação
Observação
RM12.1.21 e/ou posterioresJunho/2018Para os requisitos de software deve-se consultar a Portabilidade RM
Informações
iconfalse
Expandir
titleAlias Default
Acesse a máquina ou servidor que está executando o serviço. 
Vá ao diretório C:\totvs\CorporeRM\RM.Net e edite o arquivo RM.Host.Service.exe.config.
Inclua a tag <add key="DefaultDB" value="CorporeRM" /> dentro da limitação appSettings.
O valor a ser atribuído a tag DefaultDB deve ser idêntico ao nome do alias que aponta para a base de dados utilizada. No exemplo que citamos atribuímos o valor "CorporeRM" ao alias e respectivamente ao DefaultDB.

Bloco de código
languagexml
titleRM.Host.Service.exe.Config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<appSettings>
		<add key="JobServer3Camadas" value="false" />
		<add key="Port" value="8050" />
		<add key="ServicesHostName" value="BHD0002773" />
		<add key="ActionsPath" value="C:\totvs\CorporeRM\RM.Net;C:\totvs\CorporeRM\Corpore.Net\Bin" />
		<add key="LibPath" value="C:\totvs\CorporeRM\RM.Net" />
		<add key="EnableDynamicLocalization" value="false" />
		<add key="EnableCompression" value="false" />
		<add key="LocalizationLanguage" value="pt-BR" />
        <add key="DefaultDB" value="CorporeRM" />
	</appSettings>
	<runtime>
		<gcServer enabled="true" />
	</runtime>
</configuration>
Informações
titleAtenção

Para que estas configurações entrem em vigor será necessário reiniciar o serviço do Host.

Métodos disponibilizados pelo serviço:


MétodoURLNomeDescrição
GETrest/restprocess/getschema/{processServerName}GetSchemaFaz a leitura do Processo informado.
GETrest/restprocess/getprocessstatus/{jobId}/{execId}GetProcessStatusMonitora o progresso da execução de um processo.
POSTrest/restprocess/executeprocess/{processServerName}ExecuteProcessExecuta o processo informado
POSTrest/restprocess/executeprocessasync/{processServerName}ExecuteProcessAsyncExecuta o processo informado de forma assíncrona.

Exemplos de Utilização:


Informações
iconfalse
Expandir
titleRestProcess»localhost:8051»GetSchema

Exemplo de Uso

Body

Url: http://localhost:8051/rest/restprocess/getschema/GlbCopyPermisUsrProc

Resultado Esperado

Bloco de código
language
Bloco de código
languagejs
{
  "SourceUsuario": null,
  "RemoveOldPermissions": false,
  "CopyToAllApplications": false,
  "CodSistema": null,
  "NewUser": {
    "Usuario": null,
    "Nome": null,
    "Senha": null,
    "Email": null,
    "codAcesso": null
  },
  "PrimaryKeyList": [
    [
      "//O valor apresentado abaixo deve ser do tipo System.Int32.",
      0
    ],
    [
      "//O valor apresentado abaixo deve ser do tipo System.Double.",
      0.0
    ],
    [
      "//O valor apresentado abaixo deve ser do tipo System.String.",
      "TEXTO"
    ],
    [
      "//O valor apresentado abaixo deve ser do tipo System.DateTime.",
      "2018-06-29T00:00:00-03:00"
    ]
  ],
  "PrimaryKeyNames": [
    "COLUNAPK"
  ],
  "Context": {
    "$id": "1",
    "_params": {
      "$EXERCICIOFISCAL": 2,
      "$CODLOCPRT": 12,
      "$CODTIPOCURSO": 1,
      "$EDUTIPOUSR": "",
      "$CODUNIDADEBIB": 1,
      "$CODCOLIGADA": 1,
      "$RHTIPOUSR": "-1",
      "$CODIGOEXTERNO": "-1",
      "$CODSISTEMA": "G",
      "$CODUSUARIOSERVICO": "",
      "$IDPRJ": -1,
      "$CHAPAFUNCIONARIO": "-1",
      "$CODFILIAL": 1
    },
    "Environment": 4
  }
}

Exemplo prático no postman

Image Modified
HTML
</div>			
		</div>		
	</div>
</div>

<!-- Separador -->
<div style="padding:10px"></div>	
	
<div style="border:1px solid #aab8c6;padding:5px;-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius: 5px;background: #f7f7f7">      
	<div style="background:#f7f7f7;width:calc(100% - 10px);height:30px;color: #000;font-weight:bold;font-size: 16px;padding:5px;border-bottom: 1px solid #aab8c6;margin-bottom:14px">
		<span style="float:left"><img style="width: 16px; height: 16px; margin-top:3px" src="/download/attachments/309398329/folder3.png?version=2&modificationDate=1509366835661&api=v2" /></span>
		<span style="float:left;font-size:inherit;padding-left:5px">RestProcess</span>
		<span style="float:left;padding:0px 5px">&raquo</span>
		<span style="float:left"><img  style="width: 16px; height: 16px; margin-top:3px" src="/download/attachments/309398329/transfer3.png?version=2&modificationDate=1509366835358&api=v2" /></span>
		<span style="float:left;font-size:inherit;padding-left:5px">localhost:8051</span>
		<span style="float:left;padding:0px 5px">&raquo</span>		
		<span style="float:left"><img  style="width: 16px; height: 16px; margin-top:3px" src="/download/attachments/190516500/programming-code-signs.png?version=1&modificationDate=1509568429032&api=v2"/></span>
		<span style="float:left;padding:0px 5px">&raquo</span>
		<span style="float:left;font-size:inherit;padding-left:5px">ExecuteProcess</span>
	</div>
	<div style="border: 1px solid #aab8c6">      
		<!-- Cabeçalho -->
		<div style="background:#f7f7f7;width:calc(100% - 10px);height:30px;color: #000;font-weight:bold;font-size: 16px;padding:5px;border-bottom: 0px;">
			<span style="float:left;margin-top: 4px"><img style="width: 16px; height: 16px; margin-top:3px" src="/download/attachments/190516500/info.png?version=1&modificationDate=1509568958717&api=v2" />
			</span>
			<span style="float:left;font-size:inherit;padding-left:5px;margin-top: 3px">Informações Gerais
			</span>
		</div>
		<!-- Body -->
		<div style="background:#f0f0f0;width:calc(100% - 10px);height:auto;min-height:30px;color: #000;font-weight:bold;font-size: 16px;padding:5px;border-bottom: 0px;">
			<div style="width:100%;height:30px;border-bottom:1px solid #d0d0d0;padding-bottom:5px;">
				<span style="float:left;margin-top: 4px;font-weight:normal !important">
					<img style="width: 16px; height: 16px; margin-top:3px" src="/download/attachments/190516500/programming-code-signs.png?version=1&modificationDate=1509568429032&api=v2" />
				</span>
				<span style="float:left;font-size:inherit;padding-left:5px;margin-top: 4px;font-weight:normal !important"> 
					ExecuteProcess<b> (POST)</b>
				</span>
				<span style="float:right;margin-top: 4px;padding-right:5px;cursor:pointer" onclick="Show('hiddenDiv5', 'img5');">
					<img id="img5" name="img5" style="width: 16px; height: 16px; margin-top: 3px" src="/download/attachments/309398329/add.png?version=1&modificationDate=1509382756808&api=v2">
				</span>
			</div>
			<div id="hiddenDiv5" class="HiddenDiv" style="visibility:hidden;height: 0px; line-height: 30px; padding-left: 5px; background: #e2e2e2;">
					<strong>URL</strong>: <a href="http://localhost:8051/rest/restprocess/executeprocess/GlbCopyPermisUsrProc" target="_blank">http://localhost:8051/rest/restprocess/executeprocess/GlbCopyPermisUsrProc</a>				
			</div>			
		</div>		
		<div style="background:#f0f0f0;width:calc(100% - 10px);height:auto;min-height:30px;color: #000;font-weight:bold;font-size: 16px;padding:5px;border-bottom: 0px;">
			<div style="width:100%;height: 30px;border-bottom:0px solid #d0d0d0;padding-bottom:0px;">
				<span style="float:left;margin-top: 4px;font-weight:normal !important">
					<img style="width: 16px; height: 16px; margin-top:3px" src="/download/attachments/309398329/programming-code.png?version=1&modificationDate=1509451197195&api=v2" />
				</span>
				<span style="float:left;font-size:inherit;padding-left:5px;margin-top: 4px;font-weight:normal !important">
					ExecuteProcess<b> (Response)</b>
				</span>
				<span style="float:right;margin-top: 4px;padding-right:5px;cursor:pointer" onclick="Show('hiddenDiv6', 'img6');">
					<img id="img6" name="img6" style="width: 16px; height: 16px; margin-top: 3px" src="/download/attachments/309398329/add.png?version=1&modificationDate=1509382756808&api=v2">
				</span>
			</div>
			<div id="hiddenDiv6" style="visibility:hidden;height: 0px; line-height: 30px; padding-left: 5px; background: #e2e2e2;font-weight:normal">
			"1"
			</div>
		</div>		
	</div>	
	<!-- Separador -->
	<div style="padding:3px"></div>					
	<div style="border:1px solid #aab8c6"> 	
		<!-- Cabeçalho -->
		<div style="background:#f7f7f7;width:calc(100% - 10px);height:30px;color: #000;font-weight:bold;font-size: 16px;padding:5px;border-bottom: 0px;">
			<span style="float:left;margin-top: 4px">
				<img style="width: 16px; height: 16px; margin-top:3px" src="/download/attachments/190516500/binary-code.png?version=1&modificationDate=1509570539048&api=v2" />
			</span>
			<span style="float:left;font-size:inherit;padding-left:5px;margin-top: 3px">Exemplos
			</span>
		</div>
		<!-- Body -->
		<div style="background:#f0f0f0;width:calc(100% - 10px);height:auto;min-height:30px;color: #000;font-weight:bold;font-size: 16px;padding:5px;border-bottom: 0px;">
<div style="width:100%;height:30px;border-bottom:1px solid #d0d0d0;padding-bottom:5px;">
				<span style="float:left;margin-top: 4px;font-weight:normal !important">
					<img style="width: 16px; height: 16px; margin-top:3px" src="/download/attachments/190516500/new-page-view.png?version=1&modificationDate=1509570210360&api=v2" />
				</span>
				<span style="float:left;font-size:inherit;padding-left:5px;margin-top: 4px;font-weight:normal !important">
					Postman<b> (6.0.7)</b>
				</span>
				<span style="float:right;margin-top: 4px;padding-right:5px;cursor:pointer" onclick="Show('hiddenDiv7', 'img7');">
					<img id="img7" name="img7" style="width: 16px; height: 16px; margin-top: 3px" src="/download/attachments/309398329/add.png?version=1&modificationDate=1509382756808&api=v2">
				</span>
			</div>	
			<div id="hiddenDiv7" style="visibility:hidden;height: 0px; line-height: 30px; padding-left: 5px; background: #e2e2e2;font-weight:normal">
			
Informações
iconfalse
Expandir
titleRestProcess»localhost:8051»ExecuteProcess

Exemplo de Uso

Url: http://localhost:8051/rest/restprocess/executeprocess/GlbCopyPermisUsrProc

Body:

Bloco de código
languagejs
{
  "ActionModule": "G",
  "ActionName": "GlbActionProcCopyPermisUsr",
  "CodUsuario": "mestre",
  "SourceUsuario": "mestre",
  "RemoveOldPermissions": false,
  "CopyToAllApplications": false,
  "CodSistema": "G",
  "NewUser": {
    "Usuario": null,
    "Nome": null,
    "Senha": null,
    "Email": null,
    "codAcesso": null
  },
  "PrimaryKeyList": [
    [
      "rest"
    ]
  ],
  "PrimaryKeyNames": [
    "CODUSUARIO"
  ],
  "Context": {
    "$id": "1",
    "_params": {
      "$EXERCICIOFISCAL": 2,
      "$CODLOCPRT": 12,
      "$CODTIPOCURSO": 1,
      "$EDUTIPOUSR": "",
      "$CODUNIDADEBIB": 1,
      "$CODCOLIGADA": 1,
      "$RHTIPOUSR": "-1",
      "$CODIGOEXTERNO": "-1",
      "$CODSISTEMA": "G",
      "$CODUSUARIOSERVICO": "",
      "$IDPRJ": -1,
      "$CHAPAFUNCIONARIO": "-1",
      "$CODFILIAL": 1
    },
    "Environment": 4
  }
}

Exemplo prático no Postman

Image Added

Informações
iconfalse
Expandir
titleRestProcess»localhost:8051»ExecuteProcessAsync

Exemplo de Uso

Url: http://localhost:8051/rest/restprocess/executeprocessasync/GlbCopyPermisUsrProc

Body:

Bloco de código
languagejs
{
  "ActionModule": "G",
  "ActionName": "GlbActionProcCopyPermisUsr",
  "CodUsuario": "mestre",
  "SourceUsuario": "mestre",
  "RemoveOldPermissions": false,
  "CopyToAllApplications": false,
  "CodSistema": "G",
  "NewUser": {
    "Usuario": null,
    "Nome": null,
    "Senha": null,
    "Email": null,
    "codAcesso": null
  },
  "PrimaryKeyList": [
    [
      "rest"
    ]
  ],
  "PrimaryKeyNames": [
    "CODUSUARIO"
  ],
  "Context": {
    "$id": "1",
    "_params": {
      "$EXERCICIOFISCAL": 2,
      "$CODLOCPRT": 12,
      "$CODTIPOCURSO": 1,
      "$EDUTIPOUSR": "",
      "$CODUNIDADEBIB": 1,
      "$CODCOLIGADA": 1,
      "$RHTIPOUSR": "-1",
      "$CODIGOEXTERNO": "-1",
      "$CODSISTEMA": "G",
      "$CODUSUARIOSERVICO
Image Removed
HTML
</div>
<div style="width:100%;height: 30px;padding-bottom:5px;">
				<span style="float:left;margin-top: 4px;font-weight:normal !important">
					<img style="width: 16px; height: 16px; margin-top:4px" src="/download/attachments/309398329/programming-code.png?version=1&modificationDate=1509451197195&api=v2" />
				</span>
				<span style="float:left;font-size:inherit;padding-left:5px;margin-top: 4px;font-weight:normal !important">
					Body<b> (Raw)</b>
				</span>
				<span style="float:right;margin-top: 4px;padding-right:5px;cursor:pointer" onclick="Show('hiddenDiv8', 'img8');">
				<img id="img8" name="img8" style="width: 16px; height: 16px; margin-top: 3px" src="/download/attachments/309398329/add.png?version=1&modificationDate=1509382756808&api=v2">
				</span>
			</div>	
			<div id="hiddenDiv8" style="visibility:hidden;height: 0px; line-height: 30px; padding-left: 5px; background: #e2e2e2;font-weight:normal">
Bloco de código
languagejs
{ "ActionModule": "G", "ActionName": "GlbActionProcCopyPermisUsr", "CodUsuario": "mestre", "SourceUsuario": "mestre", "RemoveOldPermissions": false, "CopyToAllApplications": false, "CodSistema": "G", "NewUser": { "Usuario": null, "Nome": null, "Senha": null, "Email": null, "codAcesso": null }, "PrimaryKeyList": [ [ "rest" ] ], "PrimaryKeyNames": [ "CODUSUARIO" ], "Context": { "$id": "1", "_params": { "$EXERCICIOFISCAL": 2, "$CODLOCPRT": 12, "$CODTIPOCURSO": 1, "$EDUTIPOUSR
": "",
      "
$CODUNIDADEBIB
$IDPRJ": -1,
      "
$CODCOLIGADA
$CHAPAFUNCIONARIO": "-1",
      "
$RHTIPOUSR
$CODFILIAL": 
"-1"
1
    },
    "Environment": 
"$CODIGOEXTERNO": "-1", "$CODSISTEMA": "G", "$CODUSUARIOSERVICO": "", "$IDPRJ": -1, "$CHAPAFUNCIONARIO": "-1", "$CODFILIAL": 1 }, "Environment": 4 } }
4
  }
}

Exemplo prático no Postman

Image Added

Informações
iconfalse
Expandir
titleRestProcess»localhost:8051»GetProcessStatus

Exemplo de Uso

Url: http://localhost:8051/rest/restprocess/getprocessstatus/103157/1

Bloco de código
languagejs
Resultado (Erro no Processo):
{
 "Message": "Ocorreram erros ao realizar a cópia de permissões entre usuários!\r\nFavor verificar o log de execução do processo.",
 "ProcessID": {
 "ExecID": 1,
 "JobID": 103157
 },
 "Progress": 100,
 "Status": "Error"
}


Exemplo prático postman:

Image Added

Exemplo prático no Postman

Image Added

HTML
</div>

Informações
iconfalse
titlePara maiores informações:


Canais de Atendimento:

 

Chamado: Através do Portal Totvs www.suporte.totvs.com.br

Telefônico: 4003-0015 Escolhendo as opções 2 – (Software), 2 – (Suporte Técnico), 3 – (RM), 9 – (Demais Áreas), 4 – (BI) e 3 –  (Gerador de Relatórios e Planilha).

Informações
iconfalse
Informações
iconfalse

Produto: Framework

Informações
iconfalse

Versão: 12.1.21 (superiores)

Informações
iconfalse

Processo: Integração

Informações
iconfalse

SubProcesso: RestProcess

Informações
iconfalse
Informações
iconfalse

Status: Finalizado

Informações
iconfalse

Data:  

Informações
iconfalse

Autores:

Diogo Damiani Ferreira

Fábio Augusto Amaral Melo Nunes

Carlos Roberto Pereira Garcia

Stella Gleyse Macedo Vilaca

Carlos Philippe de Farias Marques