Calling a REST Web Service From an Aras Method

Calling a REST Web Service From an Aras Method

Data federation is something we are asked to implement more and more when we are evaluated for PLM projects. Mainly because of the legacy systems in place, but also because some dedicated software may be very well suited for some specific people in your company.

In our developer training classes, there is a dedicated chapter on federation explaining the different ways of federating data in Aras Innovator. It includes a lab where you actually federate customer data from a SQL database separate from your Aras Install. In the past I think it was also done with an Access database.

Depending on the target you are looking for (MS Access, MS SQL, etc.), the way you will get and update external data will differ. For years, it made sense to directly interact with other databases. But now APIs rule the world of software interactions. Our main API is published using SOAP and will soon be available as a REST service exchanging OData messages.

In the mean time you can already interact with other REST services. Here is an GET request example based on a JIRA integration I recently did for a hackathon.

All the REST call methods can be used, so here is a POST example. I will explain the full JIRA Integration (including, updating, deleting issues, and running lifecycle transitions) in a future article.

In these two methods, I use Json.NET to serialize and parse JSON. You have to download the dll (It might even already be in the Aras install nowadays) and reference it in method-config.xml. Click here to see a blog post about using an external dll.

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
The JSON I'm pushing to the web service is written inline and I find it quite dirty to do it like this. But I was in a hackathon, so not much time for clean code. It would make more sense to build an actual object and serialize it before sending it.

You should now have the basics to call any REST web service.

Stay tuned for an article about the full integration with JIRA using the REST web service!

Sean Coleman
  • :) Yep Eli has lead this project at the Labs. He should be able to give you more details if you need.
  • Hi Yoann, sorry, I always have problems to formulate my questions understandable. Handling access data is no problem! I right now just mix up the concept of Federation with the access through WebService. There are some Federation examples avaialbe, where sample SQL data is displayed into grids. I want to do something similar with JIRA data via web service. When I trigger the grid search, I want to be sure, that I don´t create to much unnecessary requests. Your sample already deals with this anyway, as it summarizes the ids into one query instead of triggering each line separatly. I have just discovered the 'ALM-PLM Integration with GitLab' sample in your project area and it seems to answer most of my question! Sometimes things look more complicated than they actually are.
  • Hi Angela, What is your "supotimal connection setup" like ? is it the connection string in the method that you don't like? Two suggestions: 1) put the connection details in variables 2) put most of this code in a dll writing your own "Jaras" class with methods that are easy to use. And then consume this dll from your method (the credentials could still be stored in variables and consumed directly from the dll)
  • Hi Yoann, I finally got the time (and the JIRA access...) to test your JIRA connection sample! The basic access worked in mintues and I successfully displayed JIRA issue data in my Aras test environment. An important first step! But now this has to be converted in solution, also suitable for use in production. My main fear is currently, that due to an supotimal connection setup from my side constantly JIRA data are queried. Do you already have more examples, recommondations or best-practice tips for creating an efficient web service connection? Thanks again!
  • Hi Angela, there is actually a blog post planned for many month and I should finalize it. I'll look into it.