I want to create a gadget that calls rest api and get the response and send it to velocity template for displaying the response in the required format.
Please suggest
Community moderators have prevented the ability to post new answers.
Hi... I am able to get the response from rest api but I'm not understanding how to send the rest api response to a velocity template I am using this rest api /rest/api/2/search?jql=project=HEL AND priority=4 After getting the response, I want to list out the issue details description and some other fields of corresponding issues on the page. <?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="__MSG_gadget.title__" title_url="__MSG_gadget.title.url__" description="__MSG_gadget.description__" author="Jobin Kuruvilla" author_email="jobinkk@gmail.com" height="150"> <Optional feature="gadget-directory"> <Param name="categories"> Other </Param> </Optional> <Require feature="dynamic-height"/> <Require feature="setprefs" /> <Require feature="views" /> <Require feature="oauthpopup" /> #supportedLocales("gadget.common") <Locale messages="__ATLASSIAN_BASE_URL__/download/resources/com.ramya.jira.sample/messages.xml"/> </ModulePrefs> <UserPref name="isConfigured" datatype="hidden" default_value="false"/> <UserPref name="refresh" datatype="hidden" default_value="false"/> <UserPref name="displayName" datatype="hidden" default_value="true"/> <UserPref name="displaypriority" datatype="hidden" default_value="true"/> <Content type="html" view="profile"> <![CDATA[ #requireResource("com.atlassian.jira.gadgets:common") #includeResources() Hellooooooo The Example goes like thissssssssssssssssss <script type="text/javascript"> (function () { var gadget = AJS.Gadget({ baseUrl: "__ATLASSIAN_BASE_URL__", config : { descriptor: function (args) { var gadget = this; return { fields: [ { userpref: "displayName", label: "Project ID", description:"projectID", type: "textarea" }, { userpref: "displayPriority", label: "issue priority", description:"Issue Priority", type: "textarea" } ] }; } }, view: { enableReload: true, onResizeAdjustHeight: true, template: function(args) { var gadget = this; console.log(args); var userDetails = AJS.$("<h1/>").text("Hello Ramyyyaaaa!"); gadget.getView().html(userDetails); }, args: [{ key: "user", ajaxOptions: function() { var gadget = this; var projectname=gadget.getPref("displayName"); var priority=gadget.getPref("displayPriority") var urlVal="/rest/api/2/search?jql=project="+projectname+" AND priority="+priority console.log("URLVAL",urlVal) return { url: urlVal }; } }] } }); })(); </script> ]]> </Content> </Module> After calling Rest api, the data is retrieved in "Template" of"view" parameter. Instead of that can we use velocity template and get the html built with the response?
Ramya, could you describe a little more what is your expectation regarding this question? Are you facing problems to develop what you mentioned?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.