Planview SOAP API guide

This is a guide to login to planview and fetch data and assign it to a custom field in Jira using the SOAP Webservice https://success.planview.com/Planview_Portfolios/Integrations/SOAP_Web_Services

Tutorial written for iHub datacenter and server, but can be performed in iHub cloud with some minor changes to the guide.

Fetch Attribute and add to custom field

In the end we will end us having a structure looking like this when fetching an attribute and adding it to a custom field

 

 Instructions

  1. Click on Credentials

    1. Select basic authentication

    2. Enter a name and click add authentication

    3. enter the user name and the password for the Jira user that will perform the update on issues

  2. Login to Planview and get the token

    1. Goto Integrations

    2. Click Create button, create a Group called Planview, this to have all actions related to Planview in the same folder structure in the tree. It has no functional impact, just structural.

    3. Click Create button, select Action and parent to be the group called Planview created in the above step. This will put a new web action in the group called Planview.
      Name it something meaningful like Planview Login

    4. Change the method to POST

    5. Add the URL to PLANVIEW_UNSTANCE_URL/planview/services/AttributeService.svc

    6. Add these headers;

      1. Content-Type: text/xml

      2. SOAPAction:http://schemas.planview.com/PlanviewEnterprise/Services/IAttributeService2/read

      3. Cookie: LoginCert= + your secret cert

  3. Click Create button, select Action and parent to be the Action called Planview Login created in the above step. This will put a new web action under the parent called Planview Login and chain the call, sending the response from the login down to the this action.
    Name it something meaningful like Planview Get Attribute

    1. Change the method to POST

    2. Add the URL to PLANVIEW_UNSTANCE_URL/planview/services/AttributeService.svc

    3. Add these headers;

      1. Content-Type: text/xml

      2. SOAPAction:http://schemas.planview.com/PlanviewEnterprise/Services/IAttributeService2/read

      3. Cookie: LoginCert= + your secret cert

      4. Cookie2: {{PLANVIEW_COOKIE}}
        This variable we will create in the later step, the idea is to pick the response from Planview Login and parse out the cookie part and send that to the read call.

  4. Click Create button, select Action and parent to be the Action called Planview Get Attribute created in the above step. This will put a new web action under the parent called Planview Attribute and chain the call, sending the response from the login down to the this action.

    Name it something meaningful like Planview Set Customfield
    Select Template Category: Jira Core Server
    Select Template: Edit Issue
    The template will just give a boilerplate to edit the issue, the details is in the tutorial below if you miss it.

    1. Change the method to PUT

    2. Add the URL to {{baseUrl}}/rest/api/2/issue/{{issue.key}}

    3. Add these headers;

      1. Content-Type: application/json

    4. Select the authentication created in the Jira authentication step

    5. Add the body

      { "fields":{"customfield_10900":"{{PLANVIEW_ATTRIBUTES}}"} }

      Change the customfield number to your instance. The syntax may vary base on customfield type so make sure to checkout this page Update Jira custom field examples. The above example sets a text field. We will come back to the {{PLANVIEW_ATTRIBUTES}} variable which will be a scripted variable.

  5. Adding variable PLANVIEW_COOKIE Click on Variables

    1. Click on tab Groovy variables

    2. Click Add

    3. Enter name PLANVIEW_COOKIE

    4. Select the second planview action called Planview Get Attribute only.
      DO NOT ADD THE PLANVIEW LOGIN TO THIS LIST.
      ADDING BOTH WILL RESOLVE IN TWO VARIABLES, PLANVIEW_COOKIE and _PLANVIEW_COOKIE WHERE YOU THEN NEED TO USE THE UNDERSCORE TO MAKE IT WORK.

    5. Add this groovy

      import org.json.JSONObject import org.json.XML JSONObject xmlJSONObj = XML.toJSONObject(response) def jsonObject = xmlJSONObj["s:Envelope"]["s:Body"]["LoginResponse"]["LoginResult"]
  6. Adding variable PLANVIEW_ATTRIBUTES Click on Variables

    1. Click on tab Groovy variables

    2. Click Add

    3. Enter name PLANVIEW_ATTRIBUTES

    4. Select the action called Planview Set Customfield only.

    5. Add this groovy

      import org.json.JSONObject import org.json.XML import com.fasterxml.jackson.databind.ObjectMapper int textIndent = 2 JSONObject xmlJSONObj = XML.toJSONObject(response) def jsonObject = xmlJSONObj["s:Envelope"]["s:Body"]["a:Successes"] ObjectMapper objectMapper = new ObjectMapper() def parsedObject = objectMapper.readValue(jsonObject.toString(), Map.class)

Highlight important information in a panel like this one. To edit this panel's color or style, select one of the options in the menu.

 Related articles

Â