Convert JSON Data into table with specific columns
Question

Hi,

I'm new to OutSystems and I cannot figure this one out from past two days. I need to create a table or get data from JIRA API into a table with 4 columns - id(which is the issue number), priority name(which is inside priority object), status name ( which is inside status object), resolution description (which is inside resolution object) on button click that calls the API.

Detailed info :

I'm trying to use JIRA API (currently public one) to get some details. I have two date inputs - from date and to date. I'm appending both the dates to the URI and passing the value to a button. On button click, API is called and I need to create a table(dynamically) and it loads the data into those 4 columns - id, priority, status, description - only, no other unnecessary data.

The API i'm using is : https://jira.atlassian.com/rest/api/2/search?jql=createdDate > 2019-01-01 and createdDate < 2019-11-30 . This is a public API. Hence I'm getting a dummy data for now which is fine. But I'm not able to get specific details from it and add them to table.

What I tried :

I convert the data from the above URI -> formatted it using json formatter -> saved it as .json file on my local -> open excel and converted the json file to excel table -> loaded that excel file into outsystems as entities -> and then fetched the data onto screens table.

Is there anyway to dynamically reload (maybe like ajax) the table, so that whenever a new date is selected it fetches a new result, gets the specific column data and display it in table format. 

HI Aman,

You can use REST API Consume method to consume the API. Below is the documentation 

https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/REST/Consume_REST_APIs/Consume_one_or_more_REST_API_methods


And you will get the Response in structures you can now create a new structure that will contain the attribute that you need for display.


In an Data action fill the result and assign the data to data table.

Attached is the working example you can check the code in Screen2

https://dbaghel.outsystemscloud.com/TestJob/Screen2


Best Regards

Devendra


TestJob.oml

Hi @Devendra Singh Baghel ,

Thank you for the help, this worked perfectly. Unfortunately, I had consumed Rest API, also created structure, but couldn't make it work. I was missing the Data action part and assigning it to the table. 


Regards,

Aman Devrath

Hello Aman,

I have understood your problem. You are getting a response from Jira API from which you have to extract some data and fill into your table. The easiest way to accomplish is by manipulating the response in OnAfterResponse callback method. You have to use Regex_replace(server action) or replace() to change the data in ResponseText as per your need. I have done similar thing in a project and can help you to format your text data if you can provide sample reponse.

Thanks,

Sanjay

Hi @Sanjay Kumar Sahu ,

Thank you for the response. The above answer helped to get what I wanted. 


Regards,

Aman Devrath

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.