{"id":29216,"date":"2023-11-06T14:30:00","date_gmt":"2023-11-06T13:30:00","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/?p=29216"},"modified":"2023-11-06T14:30:00","modified_gmt":"2023-11-06T13:30:00","slug":"alfresco-use-alfresco-for-a-trivia-game-add-questions","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/","title":{"rendered":"Alfresco &#8211; Use Alfresco for a Trivia Game &#8211; Add questions"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In a <a href=\"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-repository-skeleton\/\" target=\"_blank\" rel=\"noreferrer noopener\">previous blog<\/a>, I talked about using Alfresco to setup a simple Trivia Game and more specifically the Repository part of it, i.e., the meta-model and the structure I will use. In this second part, I will go through the REST-API commands that can be used to create new questions with their associated good\/bad answers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First of all, I would need to define the target endpoint and setup my credentials so that I can exchange with Alfresco. To keep things simple, I will use the Basic authentication with username\/password. You could of course use a ticket or another authentication mechanism that is supported as you see fit. The &#8220;<em>folder_id<\/em>&#8221; is the &#8220;<em>uuid<\/em>&#8221; of the folder in which I prepared a few questions beginning of the year for my REST-API presentation and in which I will now add a new one for this blog:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ base_url=&quot;https:\/\/alf-trivia.dbi-services.com&quot;\n$ endpoint=&quot;${base_url}\/alfresco&quot;\n$ folder_id=&quot;e6395354-d38e-489b-b112-3549b521b04c&quot;\n$ username=&quot;admin&quot;\n$ read -s -p &quot;Please enter the password of the &#039;${username}&#039; user for &#039;${endpoint}&#039;: &quot; password\nPlease enter the password of the &#039;admin&#039; user for &#039;https:\/\/alf-trivia.dbi-services.com\/alfresco&#039;:\n$\n$ auth=$(echo -n ${username}:${password} | base64)\n$\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">I decided that the name of the folders inside Alfresco would be &#8220;<em>QX<\/em>&#8221; where X is the number of the question, from 1 to infinite. Therefore, to be able to create a new question, I would first need to find out how many are currently present in my quiz. For that purpose, I&#8217;m using the GET node&#8217;s children REST-API (<a href=\"https:\/\/api-explorer.alfresco.com\/api-explorer\/#\/nodes\/listNodeChildren\" target=\"_blank\" rel=\"noreferrer noopener\">listNodeChildren<\/a>) that will list all the children of a specific node, here &#8220;<em>${folder_id}<\/em>&#8220;, with some of its details such as the children name, creation\/modification date, creator\/modifier, type, etc. In the result, all I would care about is the current total count of children that I can get easily using &#8220;<em>JQ<\/em>&#8221; (a JSON Processor command line utility):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; highlight: [1,5,11,21,32,33]; title: ; notranslate\" title=\"\">\n$ response=$(curl -k -s -X GET &quot;${endpoint}\/api\/-default-\/public\/alfresco\/versions\/1\/nodes\/${folder_id}\/children&quot; \\\n&gt;   -H &quot;Authorization: Basic ${auth}&quot; \\\n&gt;   -H &quot;Accept: application\/json&quot;)\n$\n$ echo ${response} | jq\n{\n  &quot;list&quot;: {\n    &quot;pagination&quot;: {\n      &quot;count&quot;: 6,\n      &quot;hasMoreItems&quot;: false,\n      &quot;totalItems&quot;: 6,\n      &quot;skipCount&quot;: 0,\n      &quot;maxItems&quot;: 100\n    },\n    &quot;entries&quot;: &#x5B;\n      {\n        &quot;entry&quot;: {\n          &quot;createdAt&quot;: &quot;2023-01-18T10:42:14.957+0000&quot;,\n          &quot;isFolder&quot;: true,\n          ...\n          &quot;name&quot;: &quot;Q1&quot;,\n          &quot;id&quot;: &quot;d2afbdb6-2afb-4acc-85e7-61a800e96db3&quot;,\n          &quot;nodeType&quot;: &quot;cm:folder&quot;,\n          &quot;parentId&quot;: &quot;e6395354-d38e-489b-b112-3549b521b04c&quot;\n        }\n      },\n      ...\n    ]\n  }\n}\n$\n$ echo ${response} | jq -r &quot;.list.pagination.totalItems&quot;\n6\n$\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Here, there are currently 6 children and therefore the next question to create would be &#8220;<em>Q7<\/em>&#8220;. For that purpose, I&#8217;m using the POST node&#8217;s children REST-API (<a href=\"https:\/\/api-explorer.alfresco.com\/api-explorer\/#\/nodes\/createNode\" target=\"_blank\" rel=\"noreferrer noopener\">createNode<\/a>). The HTTP Method changes compared to the previous request and with the POST, it is possible to ask Alfresco to create a child instead of listing them. Here, I can directly assign the &#8220;<em>dbi:dbi_trivia<\/em>&#8221; aspect to it, so that it would enable the specific metadata for this node:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; highlight: [1,6,9,12,13,17,18]; title: ; notranslate\" title=\"\">\n$ response=$(curl -k -s -X POST &quot;${endpoint}\/api\/-default-\/public\/alfresco\/versions\/1\/nodes\/${folder_id}\/children&quot; \\\n&gt;   -H &quot;Authorization: Basic ${auth}&quot; \\\n&gt;   -H &quot;Content-Type: application\/json&quot; \\\n&gt;   -H &quot;Accept: application\/json&quot; \\\n&gt;   -d &quot;{\n&gt;     \\&quot;name\\&quot;: \\&quot;Q${folder_nb}\\&quot;,\n&gt;     \\&quot;nodeType\\&quot;: \\&quot;cm:folder\\&quot;,\n&gt;     \\&quot;aspectNames\\&quot;: &#x5B;\n&gt;       \\&quot;dbi:dbi_trivia\\&quot;\n&gt;     ],\n&gt;     \\&quot;properties\\&quot;: {\n&gt;       \\&quot;cm:title\\&quot;:\\&quot;Question ${folder_nb}\\&quot;,\n&gt;       \\&quot;cm:description\\&quot;:\\&quot;Question #${folder_nb} of the TriviaGame\\&quot;\n&gt;     }\n&gt;   }&quot;)\n$\n$ echo ${response} | jq -r &quot;.entry.id&quot;\n46d78e31-c796-4839-bac8-e6d5a7ff5973\n$\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">With that, the new folder exists, and it has the associated aspect. The next step is purely optional, but I wanted to put a specific tag to all my questions, so that I can find them quicker in Share. For that purpose, I&#8217;m using the POST node&#8217;s tags REST-API (<a href=\"https:\/\/api-explorer.alfresco.com\/api-explorer\/#\/tags\/createTagForNode\" target=\"_blank\" rel=\"noreferrer noopener\">createTagForNode<\/a>) on the newly create folder:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; highlight: [2,7]; title: ; notranslate\" title=\"\">\n$ tag_name=&quot;triviaquestion&quot;\n$ response=$(curl -k -s -X POST &quot;${endpoint}\/api\/-default-\/public\/alfresco\/versions\/1\/nodes\/${new_folder_id}\/tags&quot; \\\n&gt;   -H &quot;Authorization: Basic ${auth}&quot; \\\n&gt;   -H &quot;Content-Type: application\/json&quot; \\\n&gt;   -H &quot;Accept: application\/json&quot; \\\n&gt;   -d &quot;{\n&gt;     \\&quot;tag\\&quot;: \\&quot;${tag_name}\\&quot;\n&gt;   }&quot;)\n$\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">The last step for the first script would then be to set the different aspect&#8217;s metadata into the newly create folder. For that purpose, I&#8217;m using the PUT node REST-API (<a href=\"https:\/\/api-explorer.alfresco.com\/api-explorer\/#\/nodes\/updateNode\" target=\"_blank\" rel=\"noreferrer noopener\">updateNode<\/a>), after prompting for the values to add exactly:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; highlight: [8,14,15,16,17,18,19,35,39,40,41,42,43,44,45,46]; title: ; notranslate\" title=\"\">\n$ question=&quot;Is it possible to use Alfresco to play a Trivia Game?&quot;\n$ answer1=&quot;Obviously not, it&#039;s just an ECM!&quot;\n$ answer2=&quot;Only if using the Enterprise version...&quot;\n$ answer3=&quot;Of course, Alfresco can do everything&quot;\n$ answer4=&quot;I don&#039;t know&quot;\n$ correct_answer=&quot;Of course, Alfresco can do everything&quot;\n$\n$ response=$(curl -k -s -X PUT &quot;${endpoint}\/api\/-default-\/public\/alfresco\/versions\/1\/nodes\/${new_folder_id}&quot; \\\n&gt;   -H &quot;Authorization: Basic ${auth}&quot; \\\n&gt;   -H &quot;Content-Type: application\/json&quot; \\\n&gt;   -H &quot;Accept: application\/json&quot; \\\n&gt;   -d &quot;{\n&gt;     \\&quot;properties\\&quot;: {\n&gt;       \\&quot;dbi:dbi_question\\&quot;:\\&quot;${question}\\&quot;,\n&gt;       \\&quot;dbi:dbi_answer1\\&quot;:\\&quot;${answer1}\\&quot;,\n&gt;       \\&quot;dbi:dbi_answer2\\&quot;:\\&quot;${answer2}\\&quot;,\n&gt;       \\&quot;dbi:dbi_answer3\\&quot;:\\&quot;${answer3}\\&quot;,\n&gt;       \\&quot;dbi:dbi_answer4\\&quot;:\\&quot;${answer4}\\&quot;,\n&gt;       \\&quot;dbi:dbi_correct_answer\\&quot;:\\&quot;${correct_answer}\\&quot;\n&gt;     }\n&gt;   }&quot;)\n$\n$ echo ${response} | jq\n{\n  &quot;entry&quot;: {\n    &quot;aspectNames&quot;: &#x5B;\n      &quot;cm:titled&quot;,\n      &quot;cm:auditable&quot;,\n      &quot;dbi:dbi_trivia&quot;,\n      &quot;cm:taggable&quot;\n    ],\n    &quot;createdAt&quot;: &quot;2023-11-03T10:12:49.804+0000&quot;,\n    &quot;isFolder&quot;: true,\n    ...\n    &quot;name&quot;: &quot;Q7&quot;,\n    &quot;id&quot;: &quot;46d78e31-c796-4839-bac8-e6d5a7ff5973&quot;,\n    &quot;nodeType&quot;: &quot;cm:folder&quot;,\n    &quot;properties&quot;: {\n      &quot;cm:title&quot;: &quot;Question 7&quot;,\n      &quot;dbi:dbi_question&quot;: &quot;Is it possible to use Alfresco to play a Trivia Game?&quot;,\n      &quot;dbi:dbi_correct_answer&quot;: &quot;Of course, Alfresco can do everything&quot;,\n      &quot;dbi:dbi_answer4&quot;: &quot;I don&#039;t know&quot;,\n      &quot;dbi:dbi_answer3&quot;: &quot;Of course, Alfresco can do everything&quot;,\n      &quot;dbi:dbi_answer2&quot;: &quot;Only if using the Enterprise version...&quot;,\n      &quot;dbi:dbi_answer1&quot;: &quot;Obviously not, it&#039;s just an ECM!&quot;,\n      &quot;cm:description&quot;: &quot;Question #7 of the TriviaGame&quot;,\n      &quot;cm:taggable&quot;: &#x5B;\n        &quot;6017bd2f-05d2-4828-9a1d-a418cf43a84e&quot;\n      ]\n    },\n    &quot;parentId&quot;: &quot;e6395354-d38e-489b-b112-3549b521b04c&quot;\n  }\n}\n$\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Putting everything together into a small bash script and then executing it again to make sure everything works, to create the 8th question:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; highlight: [87,89,97]; title: ; notranslate\" title=\"\">\n$ cat triviaAdd.sh\n#!\/bin\/bash\n\n# Define endpoint, credentials, and folder ID\nbase_url=&quot;https:\/\/alf-trivia.dbi-services.com&quot;\nendpoint=&quot;${base_url}\/alfresco&quot;\nshare=&quot;${base_url}\/share\/page&quot;\nfolder_id=&quot;e6395354-d38e-489b-b112-3549b521b04c&quot;\nusername=&quot;admin&quot;\nread -s -p &quot;Please enter the password of the &#039;${username}&#039; user for &#039;${endpoint}&#039;: &quot; password\nauth=$(echo -n ${username}:${password} | base64)\ntag_name=&quot;triviaquestion&quot;\n\n# Get number of children\necho\necho\necho &quot;Fetching the current number of questions from Alfresco...&quot;\necho\nresponse=$(curl -k -s -X GET &quot;${endpoint}\/api\/-default-\/public\/alfresco\/versions\/1\/nodes\/${folder_id}\/children&quot; \\\n  -H &quot;Authorization: Basic ${auth}&quot; \\\n  -H &quot;Accept: application\/json&quot;)\nnum_children=$(echo ${response} | jq -r &quot;.list.pagination.totalItems&quot;)\nfolder_nb=&quot;$((num_children+1))&quot;\n\n# Create new folder\nresponse=$(curl -k -s -X POST &quot;${endpoint}\/api\/-default-\/public\/alfresco\/versions\/1\/nodes\/${folder_id}\/children&quot; \\\n  -H &quot;Authorization: Basic ${auth}&quot; \\\n  -H &quot;Content-Type: application\/json&quot; \\\n  -H &quot;Accept: application\/json&quot; \\\n  -d &quot;{\n    \\&quot;name\\&quot;: \\&quot;Q${folder_nb}\\&quot;,\n    \\&quot;nodeType\\&quot;: \\&quot;cm:folder\\&quot;,\n    \\&quot;aspectNames\\&quot;: &#x5B;\n      \\&quot;dbi:dbi_trivia\\&quot;\n    ],\n    \\&quot;properties\\&quot;: {\n      \\&quot;cm:title\\&quot;:\\&quot;Question ${folder_nb}\\&quot;,\n      \\&quot;cm:description\\&quot;:\\&quot;Question #${folder_nb} of the TriviaGame\\&quot;\n    }\n  }&quot;)\nnew_folder_id=$(echo ${response} | jq -r &quot;.entry.id&quot;)\necho -e &quot;\\033&#x5B;32;1m  --&gt; A new folder &#039;Q${folder_nb}&#039; has been created: ${share}\/folder-details?nodeRef=workspace:\/\/SpacesStore\/${new_folder_id}\\033&#x5B;0m&quot;\necho\n\n# Add the tag\nresponse=$(curl -k -s -X POST &quot;${endpoint}\/api\/-default-\/public\/alfresco\/versions\/1\/nodes\/${new_folder_id}\/tags&quot; \\\n  -H &quot;Authorization: Basic ${auth}&quot; \\\n  -H &quot;Content-Type: application\/json&quot; \\\n  -H &quot;Accept: application\/json&quot; \\\n  -d &quot;{\n    \\&quot;tag\\&quot;: \\&quot;${tag_name}\\&quot;\n  }&quot;)\necho -e &quot;\\033&#x5B;32;1m  --&gt; The tag &#039;${tag_name}&#039; has been added to the folder\\033&#x5B;0m&quot;\necho\n\n# Add question, answers and correct answer\nread -p &quot;Enter the question: &quot; question\nread -p &quot;Enter the answer #1: &quot; answer1\nread -p &quot;Enter the answer #2: &quot; answer2\nread -p &quot;Enter the answer #3: &quot; answer3\nread -p &quot;Enter the answer #4: &quot; answer4\nread -p &quot;Enter the correct answer: &quot; correct_answer\nresponse=$(curl -k -s -X PUT &quot;${endpoint}\/api\/-default-\/public\/alfresco\/versions\/1\/nodes\/${new_folder_id}&quot; \\\n  -H &quot;Authorization: Basic ${auth}&quot; \\\n  -H &quot;Content-Type: application\/json&quot; \\\n  -H &quot;Accept: application\/json&quot; \\\n  -d &quot;{\n    \\&quot;properties\\&quot;: {\n      \\&quot;dbi:dbi_question\\&quot;:\\&quot;${question}\\&quot;,\n      \\&quot;dbi:dbi_answer1\\&quot;:\\&quot;${answer1}\\&quot;,\n      \\&quot;dbi:dbi_answer2\\&quot;:\\&quot;${answer2}\\&quot;,\n      \\&quot;dbi:dbi_answer3\\&quot;:\\&quot;${answer3}\\&quot;,\n      \\&quot;dbi:dbi_answer4\\&quot;:\\&quot;${answer4}\\&quot;,\n      \\&quot;dbi:dbi_correct_answer\\&quot;:\\&quot;${correct_answer}\\&quot;\n    }\n  }&quot;)\necho -e &quot;\\033&#x5B;32;1m  --&gt; The question and answers have been added to the folder\\033&#x5B;0m&quot;\necho\n$\n$\n$ # Execute the script to add a question\n$ .\/triviaAdd.sh\nPlease enter the password of the &#039;admin&#039; user for &#039;https:\/\/alf-trivia.dbi-services.com\/alfresco&#039;:\n\nFetching the current number of questions from Alfresco...\n\n  --&gt; A new folder &#039;Q8&#039; has been created: https:\/\/alf-trivia.dbi-services.com\/share\/page\/folder-details?nodeRef=workspace:\/\/SpacesStore\/0b147c71-70fd-498e-9bf6-d40a738699fa\n\n  --&gt; The tag &#039;triviaquestion&#039; has been added to the folder\n\nEnter the question: Is this working as it should?\nEnter the answer #1: Of course...\nEnter the answer #2: Maybe?\nEnter the answer #3: Definitively not\nEnter the answer #4: Why do you ask me???\nEnter the correct answer: Of course...\n  --&gt; The question and answers have been added to the folder\n\n$\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Unfortunately I cannot display the colors in our blog platform for the code sections, but if you look at the source code, you will see the script has that so that the output is clearer. Looking into Alfresco Share shows the newly created folder with the proper metadata:<\/p>\n\n\n\n<figure data-wp-context=\"{&quot;imageId&quot;:&quot;6b01bd569692e&quot;}\" data-wp-interactive=\"core\/image\" data-wp-key=\"6b01bd569692e\" class=\"wp-block-image size-large wp-lightbox-container\"><img loading=\"lazy\" decoding=\"async\" width=\"938\" height=\"1024\" data-wp-class--hide=\"state.isContentHidden\" data-wp-class--show=\"state.isContentVisible\" data-wp-init=\"callbacks.setButtonStyles\" data-wp-on--click=\"actions.showLightbox\" data-wp-on--load=\"callbacks.setButtonStyles\" data-wp-on--pointerdown=\"actions.preloadImage\" data-wp-on--pointerenter=\"actions.preloadImageWithDelay\" data-wp-on--pointerleave=\"actions.cancelPreload\" data-wp-on-window--resize=\"callbacks.setButtonStyles\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/11\/5-938x1024.png\" alt=\"\" class=\"wp-image-29221\" srcset=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/11\/5-938x1024.png 938w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/11\/5-275x300.png 275w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/11\/5-768x838.png 768w, https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/11\/5.png 1177w\" sizes=\"auto, (max-width: 938px) 100vw, 938px\" \/><button\n\t\t\tclass=\"lightbox-trigger\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"dialog\"\n\t\t\tdata-wp-bind--aria-label=\"state.thisImage.triggerButtonAriaLabel\"\n\t\t\tdata-wp-init=\"callbacks.initTriggerButton\"\n\t\t\tdata-wp-on--click=\"actions.showLightbox\"\n\t\t\tdata-wp-style--right=\"state.thisImage.buttonRight\"\n\t\t\tdata-wp-style--top=\"state.thisImage.buttonTop\"\n\t\t>\n\t\t\t<svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"12\" height=\"12\" fill=\"none\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path fill=\"#fff\" d=\"M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z\" \/>\n\t\t\t<\/svg>\n\t\t<\/button><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">That concludes the second part of this blog. If you are familiar with REST-API, writing this kind of small script shouldn&#8217;t take you more than a few minutes, let&#8217;s say 30 minutes if you want to add colors as I did and wrapper\/information around, to have something that can be presented. The first part of this blog is available <a href=\"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-repository-skeleton\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a> and the third part of this blog <a href=\"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-play-the-game\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In a previous blog, I talked about using Alfresco to setup a simple Trivia Game and more specifically the Repository part of it, i.e., the meta-model and the structure I will use. In this second part, I will go through the REST-API commands that can be used to create new questions with their associated good\/bad&hellip;&nbsp;<\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[4181,4135],"tags":[3166,3767,3165],"class_list":["post-29216","post","type-post","status-publish","format-standard","category-alfresco","category-digitalization","tag-game","tag-restapi","tag-trivia"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Alfresco - Use Alfresco for a Trivia Game - Add questions - dbi services Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Alfresco - Use Alfresco for a Trivia Game - Add questions\" \/>\n<meta property=\"og:description\" content=\"In a previous blog, I talked about using Alfresco to setup a simple Trivia Game and more specifically the Repository part of it, i.e., the meta-model and the structure I will use. In this second part, I will go through the REST-API commands that can be used to create new questions with their associated good\/bad&hellip;&nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi services Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dbiservices\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-06T13:30:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/11\/5.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1177\" \/>\n\t<meta property=\"og:image:height\" content=\"1285\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Morgan Patou\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@MorganPatou\" \/>\n<meta name=\"twitter:site\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Morgan Patou\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/\"},\"author\":{\"name\":\"Morgan Patou\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/80b23b8d61648c45dd30be73b6b6979d\"},\"headline\":\"Alfresco &#8211; Use Alfresco for a Trivia Game &#8211; Add questions\",\"datePublished\":\"2023-11-06T13:30:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/\"},\"wordCount\":595,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/11\\\/5-938x1024.png\",\"keywords\":[\"Game\",\"REST API\",\"Trivia\"],\"articleSection\":[\"Alfresco\",\"Digitalization\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/\",\"name\":\"Alfresco - Use Alfresco for a Trivia Game - Add questions - dbi services Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/11\\\/5-938x1024.png\",\"datePublished\":\"2023-11-06T13:30:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/11\\\/5.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/11\\\/5.png\",\"width\":1177,\"height\":1285},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/alfresco-use-alfresco-for-a-trivia-game-add-questions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Alfresco &#8211; Use Alfresco for a Trivia Game &#8211; Add questions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi services Blog\",\"description\":\"#BeSharing\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\",\"name\":\"dbi services\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"width\":512,\"height\":512,\"caption\":\"dbi services\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dbiservices\\\/\",\"https:\\\/\\\/x.com\\\/dbiservices\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/dbi-services\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/dbiservices\"],\"description\":\"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.\",\"email\":\"info@dbi-services.com\",\"telephone\":\"+41 32 422 96 00\",\"legalName\":\"dbi services SA\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/80b23b8d61648c45dd30be73b6b6979d\",\"name\":\"Morgan Patou\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/MOP_web-min-scaled.jpg\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/MOP_web-min-scaled.jpg\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/MOP_web-min-scaled.jpg\",\"caption\":\"Morgan Patou\"},\"description\":\"Morgan Patou has over 15 years of experience building and deploying Java\\\/J2EE applications. He specializes in Enterprise Content Management (ECM) solutions such as Alfresco and Documentum, covering open-source (Apache, OpenLDAP, Kerberos) and proprietary (WebLogic) technologies, with deep expertise in business requirement analysis, ECM architecture, and high-availability infrastructure for mission-critical environments. He oversees knowledge management and technology direction for the ECM practice. He holds Alfresco Content Services Certified Administrator (ACSCA) and Certified Engineer (ACSCE) credentials, plus an Engineering degree in Computer Science from ENSISA Mulhouse. His industry experience covers the public sector, IT, financial services\\\/banking, and pharmaceutical industries.\",\"sameAs\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/morgan-patou\\\/\",\"https:\\\/\\\/x.com\\\/MorganPatou\"],\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/morgan-patou\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Alfresco - Use Alfresco for a Trivia Game - Add questions - dbi services Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/","og_locale":"en_US","og_type":"article","og_title":"Alfresco - Use Alfresco for a Trivia Game - Add questions","og_description":"In a previous blog, I talked about using Alfresco to setup a simple Trivia Game and more specifically the Repository part of it, i.e., the meta-model and the structure I will use. In this second part, I will go through the REST-API commands that can be used to create new questions with their associated good\/bad&hellip;&nbsp;","og_url":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/","og_site_name":"dbi services Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2023-11-06T13:30:00+00:00","og_image":[{"width":1177,"height":1285,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/11\/5.png","type":"image\/png"}],"author":"Morgan Patou","twitter_card":"summary_large_image","twitter_creator":"@MorganPatou","twitter_site":"@dbiservices","twitter_misc":{"Written by":"Morgan Patou","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/"},"author":{"name":"Morgan Patou","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/80b23b8d61648c45dd30be73b6b6979d"},"headline":"Alfresco &#8211; Use Alfresco for a Trivia Game &#8211; Add questions","datePublished":"2023-11-06T13:30:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/"},"wordCount":595,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/11\/5-938x1024.png","keywords":["Game","REST API","Trivia"],"articleSection":["Alfresco","Digitalization"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/","url":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/","name":"Alfresco - Use Alfresco for a Trivia Game - Add questions - dbi services Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/11\/5-938x1024.png","datePublished":"2023-11-06T13:30:00+00:00","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/11\/5.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2023\/11\/5.png","width":1177,"height":1285},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/alfresco-use-alfresco-for-a-trivia-game-add-questions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Alfresco &#8211; Use Alfresco for a Trivia Game &#8211; Add questions"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi services Blog","description":"#BeSharing","publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.dbi-services.com\/#organization","name":"dbi services","url":"https:\/\/www.dbi-services.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","width":512,"height":512,"caption":"dbi services"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/dbiservices\/","https:\/\/x.com\/dbiservices","https:\/\/www.linkedin.com\/company\/dbi-services\/","https:\/\/www.youtube.com\/user\/dbiservices"],"description":"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.","email":"info@dbi-services.com","telephone":"+41 32 422 96 00","legalName":"dbi services SA"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/80b23b8d61648c45dd30be73b6b6979d","name":"Morgan Patou","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/MOP_web-min-scaled.jpg","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/MOP_web-min-scaled.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/MOP_web-min-scaled.jpg","caption":"Morgan Patou"},"description":"Morgan Patou has over 15 years of experience building and deploying Java\/J2EE applications. He specializes in Enterprise Content Management (ECM) solutions such as Alfresco and Documentum, covering open-source (Apache, OpenLDAP, Kerberos) and proprietary (WebLogic) technologies, with deep expertise in business requirement analysis, ECM architecture, and high-availability infrastructure for mission-critical environments. He oversees knowledge management and technology direction for the ECM practice. He holds Alfresco Content Services Certified Administrator (ACSCA) and Certified Engineer (ACSCE) credentials, plus an Engineering degree in Computer Science from ENSISA Mulhouse. His industry experience covers the public sector, IT, financial services\/banking, and pharmaceutical industries.","sameAs":["https:\/\/www.dbi-services.com\/blog\/author\/morgan-patou\/","https:\/\/x.com\/MorganPatou"],"url":"https:\/\/www.dbi-services.com\/blog\/author\/morgan-patou\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/29216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=29216"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/29216\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=29216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=29216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=29216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}