REST API Asynchronous Mode
The asynchronous mode adds to the previous one the capacity of finishing the signature process in two steps. The first allows to start/register a new signature operation which returns an object containing the unique id, status and the host/port of the host that fulfilled the request.
The host/port information is an essential aspect when there are multiple instances of the Sign’Stash Proxy running behind a load balancer or similar. There is no synchronization between the various instances of the Sign'Stash Proxy running and therefore each one keeps its own state (signature operations).
Additionally, the Sign’Stash Proxy exposes 2 methods that allow, informing the external reference used during the creation phase, to consult the status of the operation(s) and, once it is finished, to retrieve information about the signature process that includes all signed documents.
Again, notice that according to your architecture, this new request must be made through the Sign’Stash instance that handled the initial request using the host/port obtained from it.
To enable this mode it is necessary to include parameters in addition to those of the SYNC mode.
Parameter | Description |
---|---|
HOST | Address of the host running the docker image (e.g. 192.168.1.1). |
PATH_TO_WORK_FOLDER | Path to the working folder containing the configuration file (e.g. /path/to/work/folder). |
Architecture
The Sign’Stash Proxy components are in gray background, the Sign’Stash SaaS is on a green background, and the blue background pertains to the client service components.
Configuration File
A new configuration file named 'client-services-config.json' must be created inside the [PATH_TO_WORK_FOLDER] according to the following structure:
[CLIENT_SERVICE_ID]: States the client service Id used to authenticate against the REST API (e.g. PRT.505767457-PRT.123654123-84dd8c).
[CLIENT_SERVICE_SECRET]: States the client service secret used to authenticate against the REST API (e.g. my_secret)
{ "[CLIENT_SERVICE_ID1]": { "secret": "[CLIENT_SERVICE_SECRET1]" }, "[CLIENT_SERVICE_ID2]": { "secret": "[CLIENT_SERVICE_SECRET2]" } ... }
Docker Command
Start the Sign’Stash Proxy service by defining the docker command according to the following format:
docker run -d --mount source=vol[UID],target=/tmp --mount type=bind,source=[PATH_TO_WORK_FOLDER],target=/home -p [PORT]:8080 --memory=[MEMORY] [IMAGE_ID] --server.host.port=[HOST]:[PORT] --einvoice-integration-client.service.domain=[SAAS_DOMAIN] --einvoice-integration-client.rest.provider.proxy.hostname=[PROXY_HOSTNAME] --einvoice-integration-client.rest.provider.proxy.port=[PROXY_PORT]
Please refer to Docker run documentation for additional information
Execution example using staging environment:
docker run -d --mount source=vol1,target=/tmp --mount type=bind,source=C:/temp,target=/home -p 8081:8080 --memory=4g teammust/einvoice:integration-client-ws-f8ebf1180e7f430a147b84536e523fe85bdb362d-80 --server.host.port=127.0.0.1:8081 --einvoice-integration-client.service.domain=https://staging.must.digital/
API Methods
The methods supporting this service mode are:
Sequence diagram
Typical interactions between systems in this mode are presented in the following sequence diagram:
Response handling
General response handling overview: