Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
  1. Once Power Scripts is installed, go to the SIL Manager 

    Image RemovedImage Added


  2. 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 API

    Image RemovedImage Added

    Code Block
    languagejava
    titleExample
    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());
    }


  3. *** It is very important to edit the bellow line code since it's the way that the REST API can identify the current user ***

    Code Block
    languagejava
    titleExample
    request.headers += httpBasicAuthHeader("<username>", "<password>"); // Replace <username> and <password> with your Jira credentials


  4. Once your code is ready, hit the Run button. If the request succeeded, you should see a result as below:
    Image RemovedImage Added