Table of Contents |
---|
Introduction
The REST interface offered by SWS is exposed at the path:
Code Block |
---|
http://<IP-APPLIANCE>:8080/SignEngineWeb/rest/ |
This path is composed by other sub-path for every of purpose:
- admin: method for sws like remove certificate from cache
- enquiry: contain the method for obtain the information like signatures available, signer certificate, timestamps available ecc...
- sign: this is the principal path of SWS and contain the methods for apply the signature
- timestamps: methods for apply the timestamp on every type of file
And in this guide will be described how manage the error generated by the REST interface.
NOTE: this interface is available from SWS version: 2.5.52
Convention (manage the response)
SWS rest interface use this convention for create the response
Request is CORRECT, will return response code 200 with response body (if present) . Like in this example:
Request NOT-CORRECT with error managed, will return response code 400 and the header will have the field "errorMsg" with error description (in Italian) and field "errorCode" with code error. Like in this example:
NOTE: if you want the "errorMsg" in a specified language, you can use the method "enquiry/erros" will be described in the next section.
Enquiry
ENQUIRY: certificate
Table of Contents |
---|
Introduction
The REST interface offered by SWS is exposed at the path:
Code Block |
---|
http://<IP-APPLIANCE>:8080/SignEngineWeb/rest/ |
This path is composed by other sub-path for every of purpose:
- admin: method for sws like remove certificate from cache
- enquiry: contain the method for obtain the information like signatures available, signer certificate, timestamps available ecc...
- sign: this is the principal path of SWS and contain the methods for apply the signature
- timestamps: methods for apply the timestamp on every type of file
And in this guide will be described how manage the error generated by the REST interface.
NOTE: this interface is available from SWS version: 2.5.52
Convention (manage the response)
SWS rest interface use this convention for create the response
Request is CORRECT, will return response code 200 with response body (if present) . Like in this example:
Request NOT-CORRECT with error managed, will return response code 400 and the header will have the field "errorMsg" with error description (in Italian) and field "errorCode" with code error. Like in this example:
NOTE: if you want the "errorMsg" in a specified language, you can use the method "enquiry/erros" will be described in the next section.
Enquiry
ENQUIRY: certificate
Description | return the certifcate associated to "device_signer" | |||||
HttpMethod | POST | |||||
---|---|---|---|---|---|---|
Path | /rest/enquiry/certificate | |||||
Request |
| |||||
Response | return the byte array of certificate associated to device_signer |
ENQUIRY: signatures
Description | return the numer of signatures apposed from "device_signer" | |||||
HttpMethod | POST | |||||
---|---|---|---|---|---|---|
Path | /rest/enquiry/signatures | |||||
Request |
| |||||
Response | Number of signatures apposed |
ENQUIRY: signatures-available
Description | return the number of signatures which "device_signer" can apply | |||||
HttpMethod | POST | |||||
---|---|---|---|---|---|---|
Path | /rest/enquiry/certificatesignatures-available | |||||
Request |
| |||||
Response | Number of signatures available |
ENQUIRY: otps
Description | return the byte array of certificate otp list associated to "device_signer |
ENQUIRY: signatures
Description | return the numer of signatures apposed from " | ||||||||
HttpMethod | POST | ||||||||
---|---|---|---|---|---|---|---|---|---|
Path | /rest/enquiry/otps | ||||||||
Request |
| HttpMethodRequest
| POST | ||||||
Path | /rest/enquiry/signatures | ||||||||
| |||||||||
Response |
| ||||||||
Response | Number of signatures apposed |
|
ENQUIRY: timestamps-available
Description | return the number of signatures which "device_signer" can applynumeber of timestamp available (valid only for Namirial TSA account) | |||||
HttpMethod | POST | |||||
---|---|---|---|---|---|---|
Path | /rest/enquiry/signaturestimestamps-available | |||||
Request |
| |||||
Response | Number of signatures timestamps available |
ENQUIRY:
otpserrors
Description | return the otp list error description associated to "device_signer"error code | ||||||||||||
HttpMethod | POST | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Path | /rest/enquiry/otpserrors | ||||||||||||
Request | Description | return the numeber of timestamp available (valid only for Namirial TSA account)
| Response |
Expand | ||
---|---|---|
| ||
[ |
ENQUIRY: timestamps-available
| ||||||
Response |
|
Admin
ADMIN: remove-certificate-from-cache
Description | remove the certificate from cache of SWS | |||||
HttpMethod | PUT | |||||
---|---|---|---|---|---|---|
Path | /rest/admin/remove-certificate-from-cache | |||||
Request |
| |||||
Response |
Timestamps
TIMESTAMPS: apply
Description | permits to apply timestamp on specified file | ||||||
HttpMethod | POST | ||||||
---|---|---|---|---|---|---|---|
Path | /rest/enquirytimestamps/timestamps-availableapply | ||||||
Request | |||||||
timeStampPreferences | Description | return the error description associated to error code
| |||||
Response | Number of timestamps available |
ENQUIRY: errors
| |
content | file to apply timestamp |
Response |
User
USER: change-password
Description | permits to change the password associated to device signer |
HttpMethod | POST |
---|---|
Path | /rest/enquiryuser/errorschange-password |
ADMIN: remove-certificate-from-cache
Description | remove the certificate from cache of SWS | ||||||||||
HttpMethod | PUT | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Path | /rest/admin/remove-certificate-from-cache | ||||||||||
Request (for remote device signer) | |||||||||||
Request
| Response |
Expand | ||
---|---|---|
| ||
[ |
Admin
| ||||||
Request (for automatic device signer) |
| |||||
Response | Password update succesfully |
Sign
SIGN:
applyopenSession
Description | permits to apply timestamp on specified fileopen the sessione for apply multiple sign with remote device |
HttpMethod | POST |
---|---|
Path | /rest/timestampssign/applyopenSession |
Request | timeStampPreferences |
USER: change-password
Description | permits to change the password associated to device signer
| |||||
content | file to apply timestamp | Response |
User
| |
Response | String with the session |
SIGN: getRemainingTimeForSession
Description | permits to obtain the time until the session is valid | ||||||||
HttpMethod | POST | ||||||||
---|---|---|---|---|---|---|---|---|---|
Path | /rest/usersign/change-passwordgetRemainingTimeForSession | ||||||||
Request (for remote device signer) |
| ||||||||
Response | Seconds until the session is valid |
SIGN: closeSession
Description | permits to destroy the session before will expire | |||||
HttpMethod | POST | |||||
---|---|---|---|---|---|---|
Path | /rest/sign/closeSession | |||||
Request |
| |||||
ResponsePassword update succesfully |
Sign
SIGN:
openSessionsendOtpBySMS
Description | permits to open the sessione for apply multiple sign with remote devicedestroy the session before will expire | |||||||
HttpMethod | POST | |||||||
---|---|---|---|---|---|---|---|---|
Path | /rest/sign/openSessionsendOtpBySMS | |||||||
Request |
| |||||||
Response | String with the session |
SIGN:
getRemainingTimeForSessionsignCades
Description | permits to obtain the time until the session is validapply the cades signature | |||||
HttpMethod | POST | |||||
---|---|---|---|---|---|---|
Path | /rest/sign/getRemainingTimeForSessionsignCades | |||||
Request | ||||||
credentials |
| |||||
Response | Seconds until the session is valid |
SIGN: closeSession
/rest/sign/closeSession
Expand | ||
---|---|---|
| ||
{ |
SIGN: sendOtpBySMS
/rest/sign/sendOtpBySMS
Expand | ||
---|---|---|
| ||
{ |
| ||||||
cadesPreferences |
| |||||
content | file to sign | |||||
Response | byte array of signed files |
SIGN: signPades
Description | permits to apply the cades pades signature | |||||
HttpMethod | POST | |||||
---|---|---|---|---|---|---|
Path | /rest/sign/signCadessignPades | |||||
Request | ||||||
credentials |
| |||||
cadesPreferencespadesPreferences |
| |||||
content | file to sign | |||||
Response | byte array of signed files |
SIGN: signPades
Description | permits to apply the pades signature | ||||||||||||
HttpMethod | POST | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Path | /rest/sign/signPades | ||||||||||||
Request | credentials |
Expand | ||
---|---|---|
| ||
{ "username":"device signer name", "password":"PIN of device signer name", "idOtp":associated to device signer or -1, "otp":"otp code", "sessionKey":"string with sessionKey" } |
Expand | ||
---|---|---|
| ||
{ "imageheight":int, |
SIGN: signXades
Description | permits to apply the pades signature | |||||
HttpMethod | POST | |||||
---|---|---|---|---|---|---|
Path | /rest/sign/signXades | |||||
Request | ||||||
credentials |
| |||||
xadesPreferences |
| |||||
image | file with image (of appereance) | |||||
content | PDF file to sign | |||||
Response | byte array of signed files |
SIGN: signXades
Description | permits to apply the pades signature | |||||||||||||||
HttpMethod | POST | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Path | /rest/sign/signXades | |||||||||||||||
Request | credentials |
Expand | ||
---|---|---|
| ||
{ "username":"device signer name", "password":"PIN of device signer name", "idOtp":associated to device signer or -1, "otp":"otp code", "sessionKey":"string with sessionKey" } |
Expand | ||
---|---|---|
| ||
{ |
|
SIGN: signPKCS1
Description | permits to apply the raw signature (PKCS1) | |||||
HttpMethod | POST | |||||
---|---|---|---|---|---|---|
Path | /rest/sign/signPKCS1 | |||||
Request | ||||||
credentials |
| |||||
signPreferences |
| |||||
buffer | hash to sign | |||||
Response | byte array of signed files |
associated to hash signed |
Verify
Verify signatures
VERIFY: signatures
VERIFY: signPKCS1Description | permits to |
verify the signatures | |
HttpMethod | POST |
---|---|
Path | /rest/ |
verify/ |
signatures | ||||||
Request | ||||||
signedContent | file to verify | |||||
credentials |
|
|
"password":"PIN of device signer name",
"idOtp":associated to device signer or -1,
"otp":"otp code",
"sessionKey
|
|
}
Expand | ||
---|---|---|
| ||
{ |
Verify
| |
Response | Report with verify, this is a complex object: "SignedDocumentReportBean" |
VERIFY: signatures
Description | permits to verify the signaturesignatures | |||||||||||
HttpMethod | POST | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Path | /rest/verify/signatures | |||||||||||
Request | ||||||||||||
signedContent | file to verify | |||||||||||
credentials |
| signPreferences |
Expand | ||
---|---|---|
| ||
{ |
...