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
Click on Credentials
Select basic authentication
Enter a name and click add authentication
enter the user name and the password for the Jira user that will perform the update on issues
Login to Planview and get the token
Goto Integrations
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.
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 LoginChange the method to POST
Add the URL to PLANVIEW_UNSTANCE_URL/planview/services/AttributeService.svc
Add these headers;
Content-Type: text/xml
SOAPAction:
http://schemas.planview.com/PlanviewEnterprise/Services/IAttributeService2/read
Cookie: LoginCert= + your secret cert
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 AttributeChange the method to POST
Add the URL to PLANVIEW_UNSTANCE_URL/planview/services/AttributeService.svc
Add these headers;
Content-Type: text/xml
SOAPAction:
http://schemas.planview.com/PlanviewEnterprise/Services/IAttributeService2/read
Cookie: LoginCert= + your secret cert
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.
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.Change the method to PUT
Add the URL to {{baseUrl}}/rest/api/2/issue/{{issue.key}}
Add these headers;
Content-Type: application/json
Select the authentication created in the Jira authentication step
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.
Adding variable
PLANVIEW_COOKIE
Click on VariablesClick on tab Groovy variables
Click Add
Enter name PLANVIEW_COOKIE
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.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"]
Adding variable
PLANVIEW_ATTRIBUTES
Click on VariablesClick on tab Groovy variables
Click Add
Enter name
PLANVIEW_ATTRIBUTES
Select the action called Planview Set Customfield only.
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
Â