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 guid will be described how manage the error generated by the REST interface.
ENQUIRY: certificate
Description | return the certifcate associated to "device_signer"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 guid will be described how manage the error generated by the REST interface.
ENQUIRY: certificate
Description | return the certifcate associated to "device_signer" |
HttpMethod | POST |
---|
Path | /rest/enquiry/certificate |
Request |
Expand |
---|
title | request-enquiry-certificate |
---|
| { "credentials": { "username": "device_signer" } } |
|
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 | |
Request |
Expand |
---|
title | request-enquiry-signatures |
---|
| { "credentials": { "username": "device_signer" } } |
|
Response | Number of signatures apposed |
ENQUIRY: signatures-available
Description | return the number of signatures which "device_signer" can apply |
HttpMethod | POST |
---|
Path | |
certificate |
Request |
Expand |
---|
title | request-enquiry-signatures- |
---|
|
|
certificate | { "credentials": { "username": "device_signer" } } |
|
Response | Number of signatures available |
ENQUIRY: otps
byte array of certificate otp list associated to "device_signer |
ENQUIRY: signatures
Description | return the numer of signatures apposed from " |
HttpMethod | POST |
---|
Path | |
Request |
Expand |
---|
title | request-enquiry-otps |
---|
| { "credentials": { "username": "device_signer"
|
|
HttpMethodPOSTPath | |
Request | requestsignatures "credentials": { "username": "device_signer" }}Response | Number of signatures apposed |
ENQUIRY: signatures "idOtp": number, "serialNumber": "string", "type": "otp-type-enum" }, { "idOtp": number, "serialNumber": "string", "type": "otp-type-enum" } ]
|
|
ENQUIRY: timestamps-available
number of signatures which "device_signer" can applynumeber of timestamp available (valid only for Namirial TSA account) |
HttpMethod | POST |
---|
Path | |
signaturessignaturescredentials { "username "timestamp-namirial-enquiry-url", "timestampUsername": " |
|
device_signer" }tsa-username", "timestampPassword": "tsa-password" } |
|
Response | Number of |
signatures
ENQUIRY:
otpserrors
otp list error description associated to |
"device_signer"error code |
HttpMethod | POST |
---|
Path | |
otps |
Request |
Expand |
---|
title | request-enquiry-errors |
---|
| { "error_code": integer, "lang": "COUNTRY-CODE-2DIGIT" } |
|
Response | |
-otps{ "credentials": { "username": "device_signer" } } |
Response | Expand |
---|
title | response-enquiry-otps |
---|
|
[ { "idOtp": number, "serialNumber": "string", "type": "otp-type-enum" }, { "idOtp": number, "serialNumber": "string", "type": "otp-type-enum" } ] |
ENQUIRY: timestamps-available
Description | return the numeber of timestamp available (valid only for Namirial TSA account) | [ { "errorCode": integer, "errorLanguage": "CONUNTRY-CODE-2DIGIT", "errorLanguage2": "COUNTRY-CODE-3DIGIT", "errorText": "Description error in language" } ] |
|
ADMIN: remove-certificate-from-cache
Description | remove the certificate from cache of SWS |
HttpMethod | PUT |
---|
Path | /rest/admin/remove-certificate-from-cache |
Request |
Expand |
---|
title | request-enquiry-remove-certificate-from-cache |
---|
| { "error_code": integer, "lang": "COUNTRY-CODE-2DIGIT" } |
|
Response |
|
TIMESTAMPS: apply
Description | permits to apply timestamp on specified file |
HttpMethod | POST |
---|
Path | |
enquirytimestamps-available |
Request |
|
timeStampPreferences | |
enquiry-available{ "timestampUrl": "timestamp-namirial-enquiry-url", "timestampUsername": "tsa-username", "timestampPassword": "tsa-password" } |
Response | Number of timestamps available |
ENQUIRY: errors
Description | return the error description associated to error code | { "filenameInTSD": "string", "outputAsPDF": true, "outputAsTSD": true, "outputBase64Encoded": true, "timestampHashAlgo": "string", "timestampPassword": "string", "timestampUrl": "string", "timestampUsername": "string" } |
|
content | file to apply timestamp |
|
|
Response |
|
USER: change-password
Description | permits to change the password associated to device signer |
HttpMethod | POST |
---|
Path | |
enquiry/errorsRequest | Expand |
---|
title | request-enquiry-errors |
---|
|
{ "error_code": integer, "lang": "COUNTRY-CODE-2DIGIT" } |
Response |
Request (for remote device signer) | |
response-enquiry-errors | [ { "errorCode": integer, "errorLanguage": "CONUNTRY-CODE-2DIGIT", "errorLanguage2": "COUNTRY-CODE-3DIGIT", "errorText": "Description error in language" } ] |
ADMIN: remove-certificate-from-cache
Description | remove the certificate from cache of SWS |
HttpMethod | PUT |
---|
Path | /rest/admin/remove-certificate-from-cache |
Request | Expand |
---|
title | request-enquiry-remove-certificate-from-cache |
---|
|
{ "error_code": integer, "lang": "COUNTRY-CODE-2DIGIT" } |
Response | TIMESTAMPS: apply
Description | permits to apply timestamp on specified filerequest-user-change-password-remote |
| { "credentials": { "idOtp": idOtp or -1, "otp": "otpCode", "password": "old-password-of-device-signer-remote", "username": "device-signer-remote" }, "newPassword": "new-password-of-device-signer-remote" } |
|
Request (for automatic device signer) |
Expand |
---|
title | request-user-change-password-automatic |
---|
| { "credentials": { "securityCode": "securityCode associate to automatic device signer", "password": "old-password-of-device-signer-automatic", "username": "device-signer-automatic" }, "newPassword": "new-password-of-device-signer-automatic" } |
|
Response | Password update succesfully |
SIGN: openSession
Description | permits to open the sessione for apply multiple sign with remote device |
HttpMethod | POST |
---|
Path | |
timestampsapplytimeStampPreferences | timestampsapply filenameInTSD "string", "outputAsPDF": true, "outputAsTSD": true, "outputBase64Encoded": true, "timestampHashAlgo": "string", "timestampPassword": "string", "timestampUrl": "string", "timestampUsername": "string"}content | file to apply timestamp |
Response | USER: change-password
Description | permits to change the password associated to device signer { "idOtp": -1, "otp": "775351", "password": "12345678", "username": "RHIP22021116852552" } } |
|
Response | String with the session |
SIGN: getRemainingTimeForSession
Description | permits to obtain the time until the session is valid |
HttpMethod | POST |
---|
Path | |
userchange-passwordgetRemainingTimeForSession |
Request |
(for remote device signer)user-change-password-remotesign-getRemainingTimeForSession |
| { "credentials": { " |
|
idOtp idOtp or -1, "otp": "otpCode", "password": "old-password-of-device-signer-remote "zZto1G0DpL/vBFkTnK7caquzY5pasOlzS+bQG7wUkOONnbV7Vhd+JSPTjP7ZqTYR12QjS0W89T7UmnQB2KzAQ3C4NalDgFE67ntqoGm7uOU7+oOPLvKQv/p5aeZ2bcjKe6x5KQPUEH//rKaExFcLcLj8cnwXfFBixJ4MN+3o8S5535HcRxWv+YoTHHgAY16Fh0yJGfLL3x/4W+HJeiIYL2cHpKNTGkKcGTM8Eon0R+djNFvKzZSF1VIETPADqDdvgLYkRWODd3yoUvExGk5BcQKVm0Z7Nd7NMKl4NRbHumdqmqy81jchQv2qlXIxSpjZ0GTnL4vDZMF2MP2DGHPoWw==", "username": " |
|
device-signer-remote}, "newPassword": "new-password-of-device-signer-remote"}Request (for automatic device signer) |
Response | Seconds until the session is valid |
SIGN: closeSession
SIGN: openSessionDescription | permits to destroy the session before will expire |
HttpMethod | POST |
---|
Path | |
Request | |
user-change-password-automatic "securityCode": "securityCode associate to automatic device signer",passwordold-password-of-device-signer-automatic", "username": "device-signer-automatic" }, "newPassword": "new-password-of-device-signer-automatic"}Response | Password update succesfully |
zZto1G0DpL/vBFkTnK7caquzY5pasOlzS+bQG7wUkOONnbV7Vhd+JSPTjP7ZqTYR12QjS0W89T7UmnQB2KzAQ3C4NalDgFE67ntqoGm7uOU7+oOPLvKQv/p5aeZ2bcjKe6x5KQPUEH//rKaExFcLcLj8cnwXfFBixJ4MN+3o8S5535HcRxWv+YoTHHgAY16Fh0yJGfLL3x/4W+HJeiIYL2cHpKNTGkKcGTM8Eon0R+djNFvKzZSF1VIETPADqDdvgLYkRWODd3yoUvExGk5BcQKVm0Z7Nd7NMKl4NRbHumdqmqy81jchQv2qlXIxSpjZ0GTnL4vDZMF2MP2DGHPoWw==", "username": "RHIP22021116852552" } } |
|
Response |
|
SIGN: sendOtpBySMS
open the sessione for apply multiple sign with remote devicedestroy the session before will expire |
HttpMethod | POST |
---|
Path | |
openSessionopenSession "idOtp": -1, "otp": "775351",password": "12345678", "username": "RHIP22021116852552" } } |
|
Response |
String with the session
SIGN:
getRemainingTimeForSessionsignCades
obtain the time until the session is validapply the cades signature |
HttpMethod | POST |
---|
Path | |
getRemainingTimeForSessionsigngetRemainingTimeForSession "credentials": { "sessionKey": "zZto1G0DpL/vBFkTnK7caquzY5pasOlzS+bQG7wUkOONnbV7Vhd+JSPTjP7ZqTYR12QjS0W89T7UmnQB2KzAQ3C4NalDgFE67ntqoGm7uOU7+oOPLvKQv/p5aeZ2bcjKe6x5KQPUEH//rKaExFcLcLj8cnwXfFBixJ4MN+3o8S5535HcRxWv+YoTHHgAY16Fh0yJGfLL3x/4W+HJeiIYL2cHpKNTGkKcGTM8Eon0R+djNFvKzZSF1VIETPADqDdvgLYkRWODd3yoUvExGk5BcQKVm0Z7Nd7NMKl4NRbHumdqmqy81jchQv2qlXIxSpjZ0GTnL4vDZMF2MP2DGHPoWw==", "username": "RHIP22021116852552" }}Response | Seconds until the session is valid |
SIGN: closeSession
Description | permits to destroy the session before will expire |
HttpMethod | POST |
---|
Path | |
Request | Expand |
---|
title | request-sign-closeSession |
---|
|
{ "credentials": { "username": "RHIP22021116852552" } } |
Response | SIGN: signCadesDescription | permits to destroy the session before will expire |
HttpMethod | POST |
---|
Path | |
Request | "username":"device signer name", "password":"PIN of device signer name", "idOtp":associated to device signer or -1, "otp":"otp code", "sessionKey":"string with sessionKey" } |
|
cadesPreferences | |
sign-closeSession{ "credentials": { "sessionKey": "zZto1G0DpL/vBFkTnK7caquzY5pasOlzS+bQG7wUkOONnbV7Vhd+JSPTjP7ZqTYR12QjS0W89T7UmnQB2KzAQ3C4NalDgFE67ntqoGm7uOU7+oOPLvKQv/p5aeZ2bcjKe6x5KQPUEH//rKaExFcLcLj8cnwXfFBixJ4MN+3o8S5535HcRxWv+YoTHHgAY16Fh0yJGfLL3x/4W+HJeiIYL2cHpKNTGkKcGTM8Eon0R+djNFvKzZSF1VIETPADqDdvgLYkRWODd3yoUvExGk5BcQKVm0Z7Nd7NMKl4NRbHumdqmqy81jchQv2qlXIxSpjZ0GTnL4vDZMF2MP2DGHPoWw==", "username": "RHIP22021116852552" } } |
Response | SIGN: sendOtpBySMS
signCades-cadesPrefernces |
| { "filenameInTSD": "string", "outputAsPDF": boolean, "outputAsTSD": boolean, "outputBase64Encoded": boolean, "timestampHashAlgo": "string", "timestampPassword": "string", "timestampUrl": "string", "timestampUsername": "string", "hashAlgorithm": "string", "level": "enum", "withTimestamp": boolean, "counterSignature": true, "counterSignatureIndex": 0, "detached": boolean } |
|
content | file to sign |
Response | byte array of signed files |
SIGN: signPades
Description | permits to apply the |
cades pades signature |
HttpMethod | POST |
---|
Path | |
signCadessignCades | { "username":"device signer name", "password":"PIN of device signer name", "idOtp":associated to device signer or -1, "otp":"otp code", "sessionKey":"string with sessionKey" } |
|
cadesPreferencessignCadescadesPrefernces | { "filenameInTSD": "string", "outputAsPDF": boolean, "outputAsTSD": boolean, "outputBase64Encoded": boolean, "timestampHashAlgo": "string", "timestampPassword": "string", "timestampUrl": "string", "timestampUsername": "string", "hashAlgorithm": "string", "level": "enum", "withTimestamp": boolean, " |
|
counterSignature truecounterSignatureIndex 0detached boolean}content | file to sign |
Response | byte array of signed files |
SIGN: signPades
Description | permits to apply the pades signature |
HttpMethod | POST |
---|
Path | |
Request | credentials | Expand |
---|
title | request-signPades-credentials |
---|
|
{ "username":"device signer name", "password":"PIN of device signer name", "idOtp":associated to device signer or -1, "otp":"otp code", "sessionKey":"string with sessionKey" } |
padesPreferences | Expand |
---|
title | request-signXades-xadesPreferences |
---|
|
{ "filenameInTSD[ "string" ], "needAppearanceDisabled": boolean, "page": 0, "signerImage": { "fieldName": "string", "fontName": "string", "fontSize": 0, "image": "string", "imageFilename": "string", "imageURL": "string", "imageVisible": boolean, "location": "string", "reason": "string", " |
|
outputAsPDF booleanoutputAsTSD booleanoutputBase64Encoded booleantimestampHashAlgostringtimestampPassword "string"timestampUrlstringtimestampUsernamesignerImageReference": "string", " |
|
hashAlgorithm": "string", "level": "enum", "withTimestamp": boolean, "encryptInAnyCase": boolean, "encryptionPassword": "string", "lockFields": [ "string" ], "needAppearanceDisabled": boolean, "page": 0, "signerImage": { "fieldName": "string", "fontNamewithSignatureField": boolean } |
|
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 | |
Request |
|
credentials |
Expand |
---|
title | request-signPades-credentials |
---|
| { "username":"device signer name", "password":"PIN of device signer name", "idOtp":associated to device signer or -1, "otp":"otp code", "sessionKey":"string with sessionKey" } |
|
xadesPreferences |
Expand |
---|
title | request-signPades-padesPreferences |
---|
| { "filenameInTSD": "string", |
|
fontSize 0 image "string" imageFilename "string" imageURLtimestampHashAlgo": "string", |
|
imageVisible boolean location reasontimestampUsername": "string |
|
", scaled": true signerNamehashAlgorithm": "string", |
|
textPosition textVisible width int heightint, x: int y int }signerImageReferencesignatureId": "string", " |
|
withSignatureFieldwithoutSignatureExclusion": boolean, "xPathQuery": "string" } |
|
image | file with image (of appereance) |
content | PDF content | XML file to sign |
Response | byte array of signed files |
SIGN:
signXadessignPKCS1
Description | permits to apply the pades signature |
HttpMethod | POST |
---|
Path | /rest/sign/signXadessignPKCS1 |
Request |
|
credentials |
Expand |
---|
title | request-signPades-credentials |
---|
| { "username":"device signer name", "password":"PIN of device signer name", "idOtp":associated to device signer or -1, "otp":"otp code", "sessionKey":"string with sessionKey" } |
|
xadesPreferencessignPreferences |
Expand |
---|
title | request-signPadessignPKCS1-padesPreferences |
---|
| { "filenameInTSD": "string", "outputAsPDF": boolean, "outputAsTSD": boolean, "outputBase64Encoded": boolean, "timestampHashAlgo": "string", "timestampPassword | { "filenameInTSD": "string", "timestampUrloutputAsPDF": "string"true, "timestampUsernameoutputAsTSD": "string"true, "hashAlgorithmoutputBase64Encoded": "string"false, "leveltimestampHashAlgo": "enum", "withTimestamptimestampPassword": boolean, "detachedstring": boolean, "detachedReferenceURItimestampUrl": "string", "signElementtimestampUsername": "string", "signatureIdhashAlgorithm": "stringenum", "withoutSignatureExclusionlevel": boolean"enum", "xPathQuerywithTimestamp": "string"true } |
|
contentbuffer | XML file hash to sign |
Response | byte array of associated to hash signed files |