Document from G2L
Overview
You can use use this API request to migrate document from GladToLink to Legale.
Response will return the detail of document that is created from Legale.
This API request doesn't trigger any sign flow from legale, it just saves document and workflow info into db.
The difference between V1 is that we added here attached files.
Since G2L API doesn't support multi-level JSON structure, we implemented prefix and suffix rules to API request JSON body.
The Rule is:
document__
prefix to all the keys related to document data.attached_file__
prefix and__{{ index }}
suffix to all the keys related to the attached files data.workflow__
prefix to flow type data.workflow__signer__
prefix and__{{ index }}
suffix to keys related to workflow signer data.
Important: All the prefix and suffix should be connected using double underscore __
, suffix index
should be from 1
.
You can see detailed example request body below.
API detail
Request
- URL:
/migrate/g2l-document/
- Method:
POST
- Content-Type:
application/json
- Body:
{
"document__file_name": "Test",
"document__description": "3",
"document__sign_status": 1,
"document__folder": "Migration/V2/G2L",
"document__file": "JVBERi0...",
"attached_file__file__1": "/9j/4AAQS...",
"attached_file__file_name__1": "attached.png",
"workflow__flow_type": "priority",
"workflow__signer__sign_method__1": "no_sms",
"workflow__signer__sign_status__1": 2,
"workflow__signer__email__1": "signer1@gmail.com",
"workflow__signer__firstname__1": "Signer",
"workflow__signer__lastname1__1": "1",
"workflow__signer__lastname2__1": "",
"workflow__signer__sign_method__2": "certification",
"workflow__signer__sign_status__2": 0,
"workflow__signer__email__2": "signer2@gmail.com",
"workflow__signer__firstname__2": "Signer",
"workflow__signer__lastname1__2": "2",
"workflow__signer__lastname2__2": ""
}
Request body details
Value | Type | Is required | Description |
---|---|---|---|
document__file_name | str | Yes | The name of file you wanna to save as |
document__description | str | Yes | Description of document, maximum 1023 characters |
document__folder | str | No | Folder path that you wanna to save document in. If folder structure is not matched to current existing structure, system will create it. |
document__sign_status | int | No | Document sign status, default is 0 . Available values are 0 (Not signed), 1 (Signed), 2 (Rejected). |
document__file | str | Yes | Base64 string of document you wanna upload |
attached_file__file__1 | str | No | Base64 string of the attached file |
attached_file__file_name__1 | str | No | The name of file you wanna to save as, it should be a valid file name including extension |
workflow__flow_type | str | No | Sign workflow type, available values are priority , simultaneously |
workflow__signer__sign_method__1 | str | No | Sign method you wanna to use to sign document, you can see more details from here. |
workflow__signer__sign_status__1 | int | No | Sign status of the signer in workflow. Default is 0 . Available values are 0 (Not signed), 1 (In sign process), 2 (Signed), 3 (Rejected). |
workflow__signer__email__1 | str | No | Signer email, this field is required. |
workflow__signer__phone__1 | str | No | Signer phone to use receive OTP. This parameter is needed when you set sign_method as sms |
workflow__signer__firstname__1 | str | No | Signer first name |
workflow__signer__lastname1__1 | str | No | Signer first last name |
workflow__signer__lastname2__1 | str | No | Signer second last name |
Response
Success
- Status code:
201
- Body:
{
"GUID": "0fe75c65-70cc-4517-ac7f-ebba85bfa63e",
"doc_id": "50361222",
"document": "https://api.legale.io/media/document/0fe75c65-70cc-4517-ac7f-ebba85bfa63e.pdf",
"file_name": "test from postman.pdf",
"description": "test from postman",
"created_at": "2021-10-19T16:05:44.158662Z",
"updated_at": "2021-10-19T16:05:44.158662Z",
"sign_status": 0,
"comment": null,
"callback_url": null,
"callback_key": null,
}
Error
- Status code:
400
- Body:
{
"code": "NO_SERVICE_NUMBER",
"message": "Service number is not enough",
}
Error code | Type | Description |
---|---|---|
NO_SERVICE_NUMBER | str | You run out your storage in legale service, to continue, you should buy it in legale store. |