Document Assembly + SMASHDOCs: technical concept
Document Assembly + SMASHDOCs
Concept
TABLE OF CONTENTS
Abbreviations
●DA: Third-party Document Assembly software
1Basic Authentification
Depending on the DA readiness for Third-party integration we should select one on the possible ways of authentification:
1.1OAuth 2.0
We are using ORY Project for the OAuth 2.0 implementation on our side. For the Token management the ORY Hydra is used. Here are the docs:
●Flow description: https://www.ory.sh/docs/hydra/oauth2
●(Standard) https://tools.ietf.org/html/rfc6749#section-4.1
●API: https://www.ory.sh/docs/hydra/sdk/api
●Swagger docs: https://github.com/ory/hydra/blob/master/docs/api.swagger.json
●Full documentation: https://www.ory.sh/docs/
●Detailed protocol description: https://tools.ietf.org/html/rfc6749 including the Bearer Token Usage - https://tools.ietf.org/html/rfc6750
1.2Quick & dirty solution
Hardcoded endless token will be provided by SMASHDOCs.
2Get list of interview templates for a user
DA should provide SMASHDOCs with a list of interview templates available for the user in the following (or similar) form:
[{
"id" : "9cf2f2ee-34-34232-2-4", // ID of the Template
"name" : "User Agreement", // Name of the Template
"url" : "https://..." // URL of the Template
}
...
]
3Show interview
DA should provide SMASHDOCs with an URL to the interview based on the selected template (See 2. SMASHDOCs will open the URL in the new tab.
In a case user is not authorized in DA, the Log-in screen should be shown to user. After successful login attempt user should see the selected interview.
4Hand-over of WORD document to SMASHDOCs
A word file can be imported to SMASHDOCs using the following requests. Please make sure that you replace the variables shown like "<var>".
The <accesstoken> and the <system> variable will be provided by SMASHDOCs. See 1(Basic Authentification).
All other variables you will get from the context of the regarding previous request.
5Import Word-File
Request URL: https://<system>.smashdocs.net/api/imports/word/upload
Request Method: POST
Headers:
authorization: <provided accesstoken>
Content-Type: multipart/form-data;
Payload: Word file
Response:
{"importId": "<import-id>"}
5.1Process Word-File
Request URL: https://<system>.smashdocs.net/api/imports/word/<import-id>/process
Request Method: POST
Headers:
authorization: <provided accesstoken>
Response:
ignore
5.2Import Word-File
Request URL: https://<system>.smashdocs.net/api/imports/word/<import-id>/import
Request Method: POST
Headers:
authorization: <provided accesstoken>
Content-Type: application/json
Payload: <dummy json mapping provided by SMASHDOCs which fits to demo word file. See example in 5.4 >
Response:
{ [...] documentId: "<document-id>" [...] }
5.3Set Metadata
Request URL: https://<system>.smashdocs.net/api/documents/<document-id>/metadata
Request Method: POST
Headers:
authorization: <provided accesstoken>
Content-Type: application/json
Payload: {metadata: {filename: "<filename>", title: "<title>", subtitle: "<subtitle>", description: "<description>", footer: "<footer>"}}
Response:
{ [...] documentId: "<document-id>" [...] }
5.3.1Place Document to Root folder
Request URL: https://<system>.smashdocs.net/api/folders/documents/place
Request Method: PUT
Headers:
authorization: <provided accesstoken>
Content-Type: application/json
Payload: {"documentIds":["<document-id>"],"parentFolderId":"root"}
Response:
ignore
5.3.2Redirect to SMASHDOCs
window.location.href="https://<system>.smashdocs.net/document/<document-id>"
5.4JSON Import Mapping
Please find below the of SMASHDOCs standard word template style mapping (JSON format).
{
"paragraph":{
"heading 1":{
"level":0,
"paragraphDecoratorKey":"smartlist_1_heading_1",
"textType":"paragraphDecorator"
},
"heading 2":{
"level":0,
"paragraphDecoratorKey":"smartlist_1_heading_2",
"textType":"paragraphDecorator"
},
"heading 3":{
"level":1,
"paragraphDecoratorKey":"smartlist_1_heading_3",
"textType":"paragraphDecorator"
},
"heading 4":{
"level":2,
"paragraphDecoratorKey":"smartlist_1_heading_4",
"textType":"paragraphDecorator"
},
"heading 5":{
"level":3,
"paragraphDecoratorKey":"smartlist_1_heading_5",
"textType":"paragraphDecorator"
},
"Image Caption":{
"textType":"caption"
},
"Normal":{
"level":0,
"paragraphDecoratorKey":"text_1",
"textType":"paragraphDecorator"
},
"SD Anlage":{
"level":0,
"paragraphDecoratorKey":"annex",
"textType":"paragraphDecorator"
},
"SD Bibliography 1":{
"level":0,
"paragraphDecoratorKey":"bibliography",
"textType":"paragraphDecorator"
},
"SD Code":{
"level":0,
"paragraphDecoratorKey":"code",
"textType":"paragraphDecorator"
},
"SD Cover page - Subtitle":{
"level":0,
"paragraphDecoratorKey":"coverpage_subtitle",
"textType":"paragraphDecorator"
},
"SD Cover page - Text bigger":{
"level":0,
"paragraphDecoratorKey":"coverpage_text_bigger",
"textType":"paragraphDecorator"
},
"SD Cover page - Text smaller":{
"level":0,
"paragraphDecoratorKey":"coverpage_text_smaller",
"textType":"paragraphDecorator"
},
"SD Cover page - Text standard":{
"level":0,
"paragraphDecoratorKey":"coverpage_text_normal",
"textType":"paragraphDecorator"
},
"SD Cover page - Title":{
"level":0,
"paragraphDecoratorKey":"coverpage_title",
"textType":"paragraphDecorator"
},
"SD Drafting note - blue":{
"level":0,
"paragraphDecoratorKey":"note_blue",
"textType":"paragraphDecorator"
},
"SD Drafting note - Bullet point 1":{
"level":0,
"paragraphDecoratorKey":"drafting_note_bullet_1",
"textType":"paragraphDecorator"
},
"SD Drafting note - Bullet point 2":{
"level":1,
"paragraphDecoratorKey":"drafting_note_bullet_2",
"textType":"paragraphDecorator"
},
"SD Drafting note - Heading":{
"level":0,
"paragraphDecoratorKey":"drafting_note_heading",
"textType":"paragraphDecorator"
},
"SD Drafting note - NumList 1":{
"level":0,
"paragraphDecoratorKey":"drafting_note_num_1",
"textType":"paragraphDecorator"
},
"SD Drafting note - NumList 1.1":{
"level":0,
"paragraphDecoratorKey":"drafting_note_num_2",
"textType":"paragraphDecorator"
},
"SD Drafting note - red":{
"level":0,
"paragraphDecoratorKey":"note_red",
"textType":"paragraphDecorator"
},
"SD Drafting note - Text":{
"level":0,
"paragraphDecoratorKey":"drafting_note_text",
"textType":"paragraphDecorator"
},
"SD Heading - Directory":{
"level":0,
"paragraphDecoratorKey":"heading_directory",
"textType":"paragraphDecorator"
},
"SD Heading - Directory (no ToC)":{
"level":0,
"paragraphDecoratorKey":"heading_directory_no_toc",
"textType":"paragraphDecorator"
},
"SD Heading - num 1":{
"level":0,
"paragraphDecoratorKey":"heading_num_1",
"textType":"paragraphDecorator"
},
"SD Heading - num 2":{
"level":0,
"paragraphDecoratorKey":"heading_num_2",
"textType":"paragraphDecorator"
},
"SD Heading - num 3":{
"level":0,
"paragraphDecoratorKey":"heading_num_3",
"textType":"paragraphDecorator"
},
"SD Heading - num 4":{
"level":0,
"paragraphDecoratorKey":"heading_num_4",
"textType":"paragraphDecorator"
},
"SD Heading - num 5":{
"level":0,
"paragraphDecoratorKey":"heading_num_5",
"textType":"paragraphDecorator"
},
"SD Heading - num 6":{
"level":0,
"paragraphDecoratorKey":"heading_num_6",
"textType":"paragraphDecorator"
},
"SD Heading - Sub 1":{
"level":0,
"paragraphDecoratorKey":"heading_sub_1",
"textType":"paragraphDecorator"
},
"SD Heading - Sub 2":{
"level":0,
"paragraphDecoratorKey":"heading_sub_2",
"textType":"paragraphDecorator"
},
"SD Heading 1":{
"level":0,
"paragraphDecoratorKey":"heading_1",
"textType":"paragraphDecorator"
},
"SD Heading 2":{
"level":0,
"paragraphDecoratorKey":"heading_2",
"textType":"paragraphDecorator"
},
"SD Heading 3":{
"level":0,
"paragraphDecoratorKey":"heading_3",
"textType":"paragraphDecorator"
},
"SD Heading 4":{
"level":0,
"paragraphDecoratorKey":"heading_4",
"textType":"paragraphDecorator"
},
"SD Heading 5":{
"level":0,
"paragraphDecoratorKey":"heading_5",
"textType":"paragraphDecorator"
},
"SD Heading 6":{
"level":0,
"paragraphDecoratorKey":"heading_6",
"textType":"paragraphDecorator"
},
"SD Infobox 1 - Bullet":{
"level":0,
"paragraphDecoratorKey":"box_1_bullet_point",
"textType":"paragraphDecorator"
},
"SD Infobox 1 - Heading":{
"level":0,
"paragraphDecoratorKey":"box_1_heading",
"textType":"paragraphDecorator"
},
"SD Infobox 1 - List numbered":{
"level":0,
"paragraphDecoratorKey":"box_1_list_ordered",
"textType":"paragraphDecorator"
},
"SD Infobox 1 - Text":{
"level":0,
"paragraphDecoratorKey":"box_1_text",
"textType":"paragraphDecorator"
},
"SD Infobox 2 - Bullet":{
"level":0,
"paragraphDecoratorKey":"box_2_bullet_point",
"textType":"paragraphDecorator"
},
"SD Infobox 2 - Heading":{
"level":0,
"paragraphDecoratorKey":"box_2_heading",
"textType":"paragraphDecorator"
},
"SD Infobox 2 - List numbered":{
"level":0,
"paragraphDecoratorKey":"box_2_list_ordered",
"textType":"paragraphDecorator"
},
"SD Infobox 2 - Text":{
"level":0,
"paragraphDecoratorKey":"box_2_text",
"textType":"paragraphDecorator"
},
"SD Introduction - Heading":{
"level":0,
"paragraphDecoratorKey":"introduction_heading",
"textType":"paragraphDecorator"
},
"SD Joker 1":{
"level":0,
"paragraphDecoratorKey":"joker_1",
"textType":"paragraphDecorator"
},
"SD Joker 2":{
"level":0,
"paragraphDecoratorKey":"joker_2",
"textType":"paragraphDecorator"
},
"SD Joker 3":{
"level":0,
"paragraphDecoratorKey":"joker_3",
"textType":"paragraphDecorator"
},
"SD Joker 4":{
"level":0,
"paragraphDecoratorKey":"joker_4",
"textType":"paragraphDecorator"
},
"SD List - Bullet 1":{
"level":0,
"paragraphDecoratorKey":"list_bullet_1",
"textType":"paragraphDecorator"
},
"SD List - Bullet 2":{
"level":1,
"paragraphDecoratorKey":"list_bullet_2",
"textType":"paragraphDecorator"
},
"SD List - Bullet 3":{
"level":2,
"paragraphDecoratorKey":"list_bullet_3",
"textType":"paragraphDecorator"
},
"SD List - Bullet 4":{
"level":3,
"paragraphDecoratorKey":"list_bullet_4",
"textType":"paragraphDecorator"
},
"SD List - Bullet 5":{
"level":4,
"paragraphDecoratorKey":"list_bullet_5",
"textType":"paragraphDecorator"
},
"SD List - Bullet 6":{
"level":5,
"paragraphDecoratorKey":"list_bullet_6",
"textType":"paragraphDecorator"
},
"SD List - Dash 1":{
"level":0,
"paragraphDecoratorKey":"list_dash_1",
"textType":"paragraphDecorator"
},
"SD List - Dash 2":{
"level":1,
"paragraphDecoratorKey":"list_dash_2",
"textType":"paragraphDecorator"
},
"SD List - Dash 3":{
"level":2,
"paragraphDecoratorKey":"list_dash_3",
"textType":"paragraphDecorator"
},
"SD List - Dash 4":{
"level":3,
"paragraphDecoratorKey":"list_dash_4",
"textType":"paragraphDecorator"
},
"SD List - Dash 5":{
"level":4,
"paragraphDecoratorKey":"list_dash_5",
"textType":"paragraphDecorator"
},
"SD List - Dash 6":{
"level":5,
"paragraphDecoratorKey":"list_dash_6",
"textType":"paragraphDecorator"
},
"SD List (indented) 1-1":{
"level":1,
"paragraphDecoratorKey":"list_1_indented_1",
"textType":"paragraphDecorator"
},
"SD List (indented) 1-2":{
"level":2,
"paragraphDecoratorKey":"list_1_indented_2",
"textType":"paragraphDecorator"
},
"SD List (indented) 1-3":{
"level":3,
"paragraphDecoratorKey":"list_1_indented_3",
"textType":"paragraphDecorator"
},
"SD List (indented) a-1":{
"level":1,
"paragraphDecoratorKey":"list_a_indented_1",
"textType":"paragraphDecorator"
},
"SD List (indented) a-2":{
"level":2,
"paragraphDecoratorKey":"list_a_indented_2",
"textType":"paragraphDecorator"
},
"SD List (indented) a-3":{
"level":3,
"paragraphDecoratorKey":"list_a_indented_3",
"textType":"paragraphDecorator"
},
"SD List (indented) i-1":{
"level":1,
"paragraphDecoratorKey":"list_i_indented_1",
"textType":"paragraphDecorator"
},
"SD List (indented) i-2":{
"level":2,
"paragraphDecoratorKey":"list_i_indented_2",
"textType":"paragraphDecorator"
},
"SD List (indented) i-3":{
"level":3,
"paragraphDecoratorKey":"list_i_indented_3",
"textType":"paragraphDecorator"
},
"SD List (simple) 1-1":{
"level":0,
"paragraphDecoratorKey":"list_1_simple_1",
"textType":"paragraphDecorator"
},
"SD List (simple) 1-2":{
"level":1,
"paragraphDecoratorKey":"list_1_simple_2",
"textType":"paragraphDecorator"
},
"SD List (simple) 1-3":{
"level":2,
"paragraphDecoratorKey":"list_1_simple_3",
"textType":"paragraphDecorator"
},
"SD Party 1":{
"level":0,
"paragraphDecoratorKey":"party_1",
"textType":"paragraphDecorator"
},
"SD Party 1.1":{
"level":0,
"paragraphDecoratorKey":"party_2",
"textType":"paragraphDecorator"
},
"SD Party 1.1.1":{
"level":0,
"paragraphDecoratorKey":"party_3",
"textType":"paragraphDecorator"
},
"SD Preamble 1":{
"level":0,
"paragraphDecoratorKey":"preamble_1",
"textType":"paragraphDecorator"
},
"SD Preamble 1.1":{
"level":0,
"paragraphDecoratorKey":"preamble_2",
"textType":"paragraphDecorator"
},
"SD Preamble 1.1.1":{
"level":0,
"paragraphDecoratorKey":"preamble_3",
"textType":"paragraphDecorator"
},
"SD Quote":{
"level":0,
"paragraphDecoratorKey":"quote",
"textType":"paragraphDecorator"
},
"SD Quote - Author":{
"level":0,
"paragraphDecoratorKey":"quote_subtitle",
"textType":"paragraphDecorator"
},
"SD Smart list §§§ - 1":{
"level":0,
"paragraphDecoratorKey":"smartlist_1",
"textType":"paragraphDecorator"
},
"SD Smart list §§§ - 2":{
"level":0,
"paragraphDecoratorKey":"smartlist_2",
"textType":"paragraphDecorator"
},
"SD Smart list §§§ - 3":{
"level":0,
"paragraphDecoratorKey":"smartlist_3",
"textType":"paragraphDecorator"
},
"SD Smart list §§§ - 4":{
"level":0,
"paragraphDecoratorKey":"smartlist_4",
"textType":"paragraphDecorator"
},
"SD Smart list §§§ - 5":{
"level":0,
"paragraphDecoratorKey":"smartlist_5",
"textType":"paragraphDecorator"
},
"SD Smart list §§§ - 6":{
"level":0,
"paragraphDecoratorKey":"smartlist_6",
"textType":"paragraphDecorator"
},
"SD Smart list 1 - Paragraph 1":{
"level":0,
"paragraphDecoratorKey":"smartlist_1_paragraph_1",
"textType":"paragraphDecorator"
},
"SD Smart list 1 - Paragraph 2":{
"level":0,
"paragraphDecoratorKey":"smartlist_1_paragraph_2",
"textType":"paragraphDecorator"
},
"SD Smart list 1 - Paragraph 3":{
"level":1,
"paragraphDecoratorKey":"smartlist_1_paragraph_3",
"textType":"paragraphDecorator"
},
"SD Smart list 1 - Paragraph 4":{
"level":2,
"paragraphDecoratorKey":"smartlist_1_paragraph_4",
"textType":"paragraphDecorator"
},
"SD Smart list 1 - Paragraph 5":{
"level":3,
"paragraphDecoratorKey":"smartlist_1_paragraph_5",
"textType":"paragraphDecorator"
},
"SD Smart list 1 - Paragraph 6":{
"level":4,
"paragraphDecoratorKey":"smartlist_1_paragraph_6",
"textType":"paragraphDecorator"
},
"SD Table - Legend":{
"level":0,
"paragraphDecoratorKey":"table_legend",
"textType":"paragraphDecorator"
},
"SD Table - Legend numbered":{
"level":0,
"paragraphDecoratorKey":"table_legend_numbered",
"textType":"paragraphDecorator"
},
"SD Teil":{
"level":0,
"paragraphDecoratorKey":"part",
"textType":"paragraphDecorator"
},
"SD Text - Summary":{
"level":0,
"paragraphDecoratorKey":"text_summary",
"textType":"paragraphDecorator"
},
"SD Text 1 + SideNr":{
"level":0,
"paragraphDecoratorKey":"text_sidenumber_1",
"textType":"paragraphDecorator"
},
"SD Text 2":{
"level":1,
"paragraphDecoratorKey":"text_2",
"textType":"paragraphDecorator"
},
"SD Text 2 + SideNr":{
"level":0,
"paragraphDecoratorKey":"text_sidenumber_2",
"textType":"paragraphDecorator"
},
"SD Text 3":{
"level":2,
"paragraphDecoratorKey":"text_3",
"textType":"paragraphDecorator"
},
"SD Text 4":{
"level":3,
"paragraphDecoratorKey":"text_4",
"textType":"paragraphDecorator"
},
"SD Text 5":{
"level":4,
"paragraphDecoratorKey":"text_5",
"textType":"paragraphDecorator"
},
"SD Text 6":{
"level":5,
"paragraphDecoratorKey":"text_6",
"textType":"paragraphDecorator"
},
"Subtitle":{
"level":0,
"paragraphDecoratorKey":"subtitle_introduction",
"textType":"paragraphDecorator"
},
"Table Caption":{
"textType":"caption"
},
"Title":{
"level":0,
"paragraphDecoratorKey":"title_introduction",
"textType":"paragraphDecorator"
}
}