Create Project with GAIA REST API and Power Scripts
Once Power Scripts is installed, go to the SIL ManagerÂ
- Inside the console, you can use the below code to make your POST/GET request. More details about the parameters are available in :Â Creating a project with Gaia REST APIExample
struct _template { string templateName; string newProjectName; string newProjectKey; string projectLead; string confluenceLink; string username; string password; string projectType; } //Build JSON data _template t; t.templateName = "templateName"; // Replace templateName with your template name t.newProjectName = "projectName"; // Replace projectName with your project name t.newProjectKey = "projectKey"; // Replace projectKey with your project key t.projectLead = "projectLead"; // Replace projectLead your project lead username t.confluenceLink = "Confluence"; t.username = "confluenceUsername"; // Replace confluenceUsername with your confluence username t.password = "confluencePassword"; // Replace confluencePasswordwith your confluence password t.projectType = "software"; //Generate HTTP request HttpRequest request; request.headers += httpCreateHeader("Content-Type", "application/json"); request.headers += httpBasicAuthHeader("<username>", "<password>"); // Replace <username> and <password> with your Jira credentials //Send requets and get result string result = httpPost(getJIRABaseUrl() + "/plugins/servlet/gaia/rest/project", request, t); //Display result or error messages number statusCode = httpGetStatusCode(); if (statusCode >= 200 && statusCode < 300) { runnerLog(result); } else { runnerLog(trim(statusCode) + " : " + httpGetErrorMessage() + " : " + httpGetReasonPhrase()); }
*** It is very important to edit the bellow line code since it's the way that the REST API can identify the current user ***
Examplerequest.headers += httpBasicAuthHeader("<username>", "<password>"); // Replace <username> and <password> with your Jira credentials
Once your code is ready, hit the Run button. If the request succeeded, you should see a result as below: