PT | EN

EFAPI Desktop Application User Guide

Introduction

The EFAPI application (Online Delivery of Customs Files) allows the automatic or interactive transfer of files through a user-friendly and economic channel (Internet).

Available operations include sending and retrieving files securely, listing and deleting responses regarding file submissions.

Users interact with the system using:

  1. An option available in EFAPIINTER that allows the "manual" sending and capturing of files;
  2. A client application that works through a command line on the user's machine and allows the sending and capturing of files automatically.

This guide aims to provide the basic elements of the EFAPI application in order to facilitate its use by economic operators regarding the electronic transfer of data within the scope of Export, Import and Transit.

Characterisation of the EFAPI Application

Users

The application is available to users with the following profiles:

  • DAV (SFA user);
  • DUE (STADA Export user);
  • DUI (STADA Import user);
  • TRS (Transit user).

To obtain one of these profiles, i.e. if you do not yet have the desired profile, you must ask GUE (link in "Useful Links" section) to assign you the desired profile.

Restrictions

The functionalities of the EFAPI application can only be accessed and used by users with one of the profiles indicated above.

Each user will only be able to carry out send, retrieve, list and delete operations on their own files. Below we indicate a table with the types of documents that can be sent, received and removed according to the profile of the operator.

Profile Vehicle Customs Declaration Electronic Transit Declaration Electronic Export Declaration Exit Summary Declaration Single Administrative Document (DUI2) Unique Import Document (DUI)
DAV X
DUE X X
DUI X X
TRS X

Functionalities ensured

The application is designed to ensure the following:

  • File transfer between the user's machine and EFAPI, either automatically or interactively ("manually");
  • Files sent and their replies can be deleted at the user's option (automatically via command line or interactively via browser);
  • Only properly authenticated users can use this service;
  • Users can only perform operations on their own files;
  • Files sent and their replies will be saved on the file system until they are deleted;
  • The responses that are sent to the recycling board will be subject to periodic cleaning;
  • All communications will be carried out over a secure channel (in this case HTTP over SSL) guaranteeing the confidentiality and integrity of the messages exchanged.

Available environments

EFAPI Internet provides two environments via the Portal Aduaneiro through these addresses:

Both environments allow the use of EFAPI, with the quality/testing environment aimed at verifying the application before going into production.

EFAPI Client Application

Minimum Requirements
  • Internet connection;
  • Java Runtime Environment version 8 (JRE8).
Installation

After making sure that the operator's machine has the minimum requirements to use the application, it is necessary to obtain the application installer in order to install and run it. The following steps should be performed:

  1. After accessing the application download page, you should choose the installer that corresponds to the operating system of your computer. In this example, we have chosen the EFAPI installer for the Windows operating system. After selecting the desired installer, the installer download will start. After the download has finished you should have an "Open File" option in the browser download bar to open the installer via your browser. You can also go to your computer's download folder and run it from the system file explorer:
Application Downloaded

After running the application installer, follow the installation steps:

  1. Introduction:
Introduction
  1. Choose the installation directory (we suggest setting it to the path predefined by the installer):
Choose the Installation Directory
  1. Select where the shortcut should be installed in the Start menu:
Select Where to Install the Shortcut in the Start Menu
  1. Indicate whether or not you want to create a desktop shortcut:
Create Desktop Shortcut
  1. Installation completed:
Installation Completed
  1. Verify that the folder and files were successfully installed:
Installation Successfully
Configuration

After installation, the operator normally performs tests in Quality to get familiar with the use of the program and test that everything is working correctly. For the operator to be able to test in Quality it is necessary to perform the following steps:

  1. Access the folder where the application was installed;
  2. Open the "config.properties" file with Notepad/Notepad++;
  3. Place a '#' before the "server.url" property to comment out the Production endpoint (line 5);
  4. Remove the '#' that is placed before the property "server.url" to uncomment the Quality endpoint (line 8);
  5. Save the changes to the file;
  6. Close Notepad.

After performing the tests in Quality, if the operator wants to perform operations in the Production environment he will have to comment the Quality endpoint and uncomment the Production one and save the changes in the "config.properties" file.

Using the EFAPI Client Application

The use of the command line allows manual intervention by the user, however, its main objective and greatest advantage is to enable its invocation from a user application in order to automate the operations of sending and receiving files.

File upload
Context The entity wants to send a DU file using the command line
Primary actor Entity
Preconditions The primary actor exists in the Portal de Finanças and has the required profile
Guarantees The application guarantees, under all circumstances, the creation of the secure channel and authentication before the system
Expected frequency Frequently
Restrictions and limitations
  • You cannot send more than one file at a time
  • The content of the files is not validated, so it is possible to send an invalid file (although validation takes place in the central system)
  • You cannot upload files larger than 2MB
Start event The user accesses the command line

Example of command

With the command line open via the application's shortcut or .cmd file, execute the command "efapi -n NIF_test -p password_test -c enviar -d local_path_of_folder_where_the_file_is_located -f file_name -t file_type" -a (the 'a' is an optional flag in case the user wants to remove local file after the upload has been performed).

If the response code returned is 0, the operation was successful.

If the test user is a subuser (userID different than 0) it is necessary to indicate the -u flag after the nif (-n). If the -u flag is omitted, the user ID is by default 0. So an example command with the user ID set would be: efapi -n NIF_test -u user_id_test -p password_test -c enviar -d path_location_of_file_to_be_sent -f file_name -t file_type.

File download
Context The operator wants to receive all responses to the files he sent using the command line
Primary actor User
Preconditions The primary actor is registered in the Portal de Finanças and has the necessary profile for the type of file he wants to receive.
Guarantees The application guarantees, in all circumstances, the creation of the secure channel and authentication before the system
Expected frequency Frequently
Restrictions and limitations
  • If one (or more) of the answers is not correctly saved on the local file system (error code returned), none of the answers will be deleted from the Portal
  • User can only get a maximum of 100 answers (files) per request. User will have to send another download request to get the remaining answers stored in server.
Start event The user accesses the command line

Example of command

With the command line open via the application's shortcut or .cmd file, run the command "efapi -n NIF_test -p password_test -c receber -d path_of_local_directory_to_save_files_coming_from_server -t file_type" -a (the 'a' is an optional flag in case the user wants to remove the files from the server after receiving them).

If the response code returned is 0, the operation was successful. If there were files on the server side associated to the NIF, the user should receive them in the folder where he indicated in the command. However, even though it returns the response with the code 0, the user may not receive any files because there is not one present on the server that is associated with the NIF and sub-user id given in the command.

If the test user is a subuser (userID different than 0) it is necessary to indicate the -u flag after the nif (-n). If the -u flag is omitted, the user ID is by default 0. So an example command with the user ID set would be: efapi -n NIF_test -u user_id_test -p password_test -c receber -d path_of_local_directory_to_save_from_server -t file_type -a (optional).

Error codes

Code Error Message
-1 Unknown error
0 Successfully performed operation
1 Local file does not exist
2 File already exists in the local directory
3 File already exists on the server
4 File size too large
5 Invalid arguments in the given command
6 Error when uploading the file
7 Error when downloading the file/s
8 Error when trying to delete local file
9 Error when trying to delete file on the server
10 Unauthenticated user
11 User does not have the necessary profiles to perform operations on this type of file
12 Invalid type of operation
13 Type of file indicated is invalid
14 Error when trying to save local file. Check if you have disk space or permissions to save the file in the specified directory
15 Error when trying to save file on the server. There may be low disk space on the server
16 Communications Error. Check that you do not have to set the proxy values in the "config.properties" file of the Application
17 Remote filesystem unavailable or invalid path
18 File name contains invalid characters or has too many characters
19 The given directory is invalid
20 Invalid Java Virtual Machine
21 User temporarily blocked due to several failed login attempts. Try again later.