User Manual

08.14.2024

MANUAL

Developer Features: Script: $p.apiCreateSite

## Overview This is a script function that allows you to create a site using Ajax POST requests. ## Syntax ##### JavaScript ``` $p.apiCreateSite({ id: (Parent Site ID), data: { (Site information to be created) }, done: (Optional Processing), fail: (Optional Processing), always: (Optional Processing) }); ``` ## Explanation Of Each Parameter |Parameter name|Description|Required| |:--|:--|:--:| |id|Specify the parent site ID of the site to be created. If "0" is specified, it will be created at the top of the site. |○| |data|Specify the site information data to be created. *See additional information in the margin|-| |done|Describes the process to be performed when API communication is successful. |○| |fail|Describes the process to be performed when API communication fails. |-| |always|Describes the process to be performed when completion is complete. |-| *The site information data must be set to the same value as the "Site" parameter when the site package was exported. After obtaining site information with [$p.apiGetSite](/manual/script-api-get-site), the process is assumed to be such that any item can be changed to create request data. ## Usage Example ##### JavaScript ``` $p.apiCreateSite({ id: 123, data: { ApiVersion: 1.1, TenantId: 1, Title: 'Site name', ReferenceType: 'Issues', ParentId: 99999, InheritPermission: 99999, SiteSettings: { Version: 1.017, ReferenceType: 'Issues', GridColumns: [ 'IssueId', 'TitleBody', 'Comments', 'StartTime', 'CompletionTime', 'WorkValue', 'ProgressRate', 'RemainingWorkValue', 'Status', 'Manager', 'Owner', 'Updator', 'UpdatedTime' ], EditorColumnHash: { General: [ 'IssueId', 'Ver', 'Title', 'Body', 'StartTime', 'CompletionTime', 'WorkValue', 'ProgressRate', 'RemainingWorkValue', 'Status', 'Manager', 'Owner', 'Comments' ] } } }, done: function (data) { //Optional Processing }, fail: function (data) { //Optional Processing }, always: function (data) { //Optional Processing } }); ``` ### If you want to manipulate Access rights settings The site creation API grants access rights to the executing user as the creator, but it is possible to disable the creator's access rights by setting the parameter "DisableSiteCreatorPermission" to true. In addition, it is possible to grant access rights to any user by specifying the parameter "Permissions". In the example below, it is assumed that the command will be executed on an edit screen with Classification A (Set User Options) enabled, and the creator's access rights are disabled and administrator privileges (511) are granted to the target user ID. The numeric access rights that can be specified are the logical sum of the values ​​listed in "enum Types" in the source code below. https://github.com/Implem/Implem.Pleasanter/blob/master/Implem.Pleasanter/Libraries/Security/Permissions.cs ##### JavaScript ``` // Get the user ID for which access rights should be set var targetUserId = $p.getControl('ClassA').attr("data-value"); $p.apiCreateSite({ id: 123, data: { ApiVersion: 1.1, TenantId: 1, Title: 'Site name', ReferenceType: 'Issues', ParentId: 99999, InheritPermission: 99999, DisableSiteCreatorPermission: true, Permissions: [ 'User,' + targetUserId + ',511' ], SiteSettings: { Version: 1.017, ReferenceType: 'Issues', GridColumns: [ 'IssueId', 'TitleBody', 'Comments', 'StartTime', 'CompletionTime', 'WorkValue', 'ProgressRate', 'RemainingWorkValue', 'Status', 'Manager', 'Owner', 'Updator', 'UpdatedTime' ], EditorColumnHash: { General: [ 'IssueId', 'Ver', 'Title', 'Body', 'StartTime', 'CompletionTime', 'WorkValue', 'ProgressRate', 'RemainingWorkValue', 'Status', 'Manager', 'Owner', 'Comments' ] } } }, done: function (data) { //Optional Processing }, fail: function (data) { //Optional Processing }, always: function (data) { //Optional Processing } }); ``` ### Creating a Wiki ##### JavaScript ```javascript $p.apiCreateSite({ id: 123, data: { ApiVersion: 1.1, Title: "Wiki Name", ReferenceType: "Wikis", ParentId: 1, InheritPermission: 1, SiteSettings: { Version: 1.017, ReferenceType: "Wikis", NoDisplayIfReadOnly: false } }, done: function (data) { //Optional Processing }, fail: function (data) { //Optional Processing }, always: function (data) { //Optional Processing } }); ``` ## Related Information <div id="ManualList"> <article class="s-blog_list_unit"><h2> <h2>The specified information was not found.</h2> <p><a href="/ja/manual">Return to top</a></p> </article> </div><input id="SearchTextHidden" type="hidden" value="" />
TOP
このページをシェアする
記載された商品名、各製品名は各社の登録商標または商標です。 © Implem Inc.