V10 ResourcesWeb API
ResourcesWeb API
Web API
Back | List of Articles

Web API Features

Last changed in 16/03/2023

The Web API of version 10 of the PRIMAVERA ERP has several specific characteristics that you should know before starting to use it, and that will be shown below.

Installation

Before starting, you must have the WebAPI module installed and the IIS server configured and running. The Web API always runs on a local server, that is, on the client's infrastructure.

 width=

Another particularity of the Web API is that it does not necessarily need to be installed on the same machine as the PRIMAVERA ERP. You can install the Web API on a dedicated server. You will only need to modify the 'ERPInstalationPath' key in the Web.Config.

  
    
    
    
    

Web API Endpoints

The Web API provides service endpoints in a specific route format. All routes are built similarly to the API to simplify the understanding of the various resources.

URL:

http://localhost:2018/WebApi/{module}/{entity}/{service}/

The route always has the same structure, with the following variable elements:

  • Module: identifies the module to which the request resource belongs.
  • Entity: identifies the entity to which you want to access
  • Service: Identifies the operation to be performed

Example:

http://localhost:2018/WebApi/Base/Clientes/Actualiza

On the ERP administrator, you can control the access to services existent on the Web API, taking into consideration the role definitions assigned to the user.

Authentication

The Web API requires all requests to be authenticated. The authentication method used is the OAuth 2.0 standard.

In practice, Web API requests should be preceded by a call to an endpoint that will authenticate the user and the application. This is the endpoint:

http://localhost:2018/WebApi/token

The parameters are:

  • username: username used in the ERP
  • password: user password used in the ERP
  • company: company code
  • instance: ERP instance, typically 'Default'
  • line: this can have one of the following values 'executive' or 'professional'
  • grant_type: authentication type used by the OAuth framework 2. In this case it will always be 'password'

The response to this request will provide the redirect link for the endpoint with the authentication data:

  • access_token: the authentication token with its lifetime
  • token_type: Bearer
  • expires_in: 1199

These details must be used in the following Web API requests by adding the following headers:

  • Authorization: Bearer {acess_token}.
  • Accept: application/json.
Bookmark or share this article
Esta página foi útil?
Obrigado pelo seu voto.

login para deixar a sua opinião.

Obrigado pelo seu feedback. Iremos analisá-lo para continuarmos a melhorar!
Artigos Relacionados
Utilizar o Postman para testar a WebAPI Formato dos pedidos Web API ERP10 Características da Web API Como executar listas na WebAPI? Web API - Conceitos e Arquitetura