Hi,
I write here first rather than on the usual list because the theme is rather technical.
I'd like to be able to use Jira's API to retrieve the status of a ticket using the JSON output, and update a tiddler field with this result.
I think I have almost all the tracks at hand, but I don't have the skills to implement them..
1. API Jira
Link to the documentation:
I add this link with a JS function to get what I want:
(last post with version 7):
function getCurrentIssueStatus()
{
var statusname;
var issueKey = JIRA.Issue.getIssueKey();
AJS.$.ajax({
url: "/rest/api/2/issue/" + issueKey,
type: 'get',
dataType: 'json',
async: false,
success: function(data) {
statusname = data.fields.status.name;
}
});
return statusname;
}
It's
About CORS potential limitation, I've got the next.
2. Cartographie demo
Last year, I had the help of a user to realize a GPS coordinates search function.
The principle, calling an API with an address, retrieving the JSON, and updating the field of a tiddler,
is exactly what I want to do here!We don't have too much news from Jean-Bernard on the FR forum, so I ask for help here :)
His work can be found here:
https://github.com/oxydum/cartographie
He wrote this function : $:/.macros/geopoint.js
(function(){
"use strict";
exports.name = "geopoint";
exports.params = [ {name: "tiddlername"},{name: "url"},{name: "tag"},{name: "link"}];
exports.run = function(tiddlername,url,tag,link) {
var url = url || "None";
var tag = tag || "Adresse";
var link = link || "";
var head = "origin:*";
var cors_api = "https://cors-anywhere.herokuapp.com/";
//var cors_api = "https://thingproxy.freeboard.io/fetch/";
//var cors_api = "http://cors.io/?";
//var cors_api = "https://crossorigin.me/";
//var cors_api = "https://cors-proxy.htmldriven.com/?url=";
var tiddlername = tiddlername || "None";
$tw.utils.httpRequest({headers:head, url: cors_api+url, callback: function (error,data){
if (error){
console.log("ERROR:"+error);
}
if (!$tw.wiki.getTiddler(tiddlername)) {
$tw.wiki.addTiddler({title:tiddlername, tags:tag, text:data, type: "application/json"});
} else {
// le tiddler existe déjà
}
}})
if (link=="") {
return;
} else { return "[["+tiddlername+"]]";}
};
})();
in addition with $:/_template_ville.
So here's where I'm now.
Does anyone have time to look at it and guide me?
Thanks,
Sylvain