Skip to content

Commit

Permalink
Merge pull request #20 from SoftwareAG/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
sagpembo authored Nov 13, 2023
2 parents 780006d + 286dc76 commit 2ca4d6b
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 4 deletions.
2 changes: 1 addition & 1 deletion flowservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function init(inDomainName, inUsername, inPassword,inTimeout,inPrettyPrint,proje
timeout = inTimeout;
prettyprint = inPrettyPrint;

url = "https://" + domainName + "/enterprise/v1/rest/projects/" + projectId ;
url = "https://" + domainName + "/apis/v1/rest/projects/" + projectId ;
debug("Username [" + username + "]");
debug("URL [" + url + "]");
debug("Timeout [" + timeout + "]");
Expand Down
49 changes: 48 additions & 1 deletion projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,26 @@ $ node wmiocli.js
-u user
-p password
project-triggers-delete project-uid trigger-uid
\x1b[32mList Reference Data List:\x1b[0m
$ node wmiocli.js
-d tenant.int-aws-us.webmethods.io
-u user
-p password
referencedata project_name
e.g.
project-ref-data project-uid
\x1b[32mList Reference Data List:\x1b[0m
$ node wmiocli.js
-d tenant.int-aws-us.webmethods.io
-u user
-p password
referencedata project_name ref-data-name <json/csv>
e.g.
project-ref-data project-uid ref-data-name json
project-ref-data project-uid ref-data-name csv
`;
}
function init(inDomainName, inUsername, inPassword, inTimeout, inPrettyprint) {
Expand Down Expand Up @@ -190,6 +210,32 @@ function processResponse(data, status) {
}
}

/* reference data */
function listRefData(projectId){
debug("List Reference Data - Project [" + projectId + "]");
url += "/" + projectId + "/referencedata";
request.get(url, username, password, timeout, processResponse);
}

function getRefData(projectId,refDataName,format){
debug("Getting Reference Data - Project [" + projectId + "] name [" + refDataName + "] format [" + format + "]");
url += "/" + projectId + "/referencedata + "/ + refDataName;
if(format && format.toLowerCase()=="csv")request.getPlain(url, username, password, timeout, processResponse);
else request.get(url, username, password, timeout, processResponse);
}

function addRefData(projectId,name,description,filename,encoding,separator,qualifier){
debug("Adding Reference Data to project [" + projectId + "]");
var body={};
body.name = name;
body.description = description;
//file
body.file_encoding = encoding;
body.field_separator = separator;
body.text_qualifier=qualifier;
}


/* Projects */
function list(projectId) {

Expand Down Expand Up @@ -349,5 +395,6 @@ module.exports = {
listAssets, listAssetsDetailed, pub, deploy,
createParam, updateParam, listParam, deleteParam,
listWebhooks, regenWebhook, setWebhookAuth,
listTriggers, deleteTrigger
listTriggers, deleteTrigger,
listRefData, getRefData
};
14 changes: 12 additions & 2 deletions rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,17 @@ function requestModifiers(options){
setignoreTLS(options);
}


function getPlain(restEndPoint,user,pass,timeout,callback)
{
get(restEndPoint,user,pass,timeout,callback,"text/plain")
}

function get(restEndPoint,user,pass,timeout,callback)
{
get(restEndPoint,user,pass,timeout,callback,"application/json")
}
function get(restEndPoint,user,pass,timeout,callback,accept)
{
debug("GET:" + restEndPoint);
var options = {
Expand All @@ -71,7 +81,7 @@ function get(restEndPoint,user,pass,timeout,callback)
timeout: timeout*1000,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
'Accept': accept
},
auth: {
username: user,
Expand Down Expand Up @@ -425,4 +435,4 @@ function custom(restEndPoint,user,pass,timeout,jsonBody,formBody,type,callback,c
});
}

module.exports = { get, post, put, del, postDownloadFile, postUploadFile, downloadFile, httpDelete, custom, addCookieToJar, displayCookies };
module.exports = { get, getPlain, post, put, del, postDownloadFile, postUploadFile, downloadFile, httpDelete, custom, addCookieToJar, displayCookies };
8 changes: 8 additions & 0 deletions webmethods-io-integration-apicli.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}

0 comments on commit 2ca4d6b

Please sign in to comment.