POST script in SIL

Ivan D August 13, 2021

Hello,

I'm noobie in SIL and I need to create a http POST request to send on transition some issue fields to a DB server and to get confirmation it's delivered.

The DB admin provided me with a connection string like:

curl -location -request POST 'https://xxxxx.yyyyy.org/db/hs/tikets/<issue key>/updateinfo' \
--header 'Authorization: Basic abCDefghjk' \
--header 'Content-Type: text/plain' \
--data-raw '{Test:True}'

The data to send can be in JSON.

My code is:

 

struct property { 
 string property; 
 string value;
struct properties { 
 property [] properties;
struct returnData { 
 string status; 
 string issueId;
}
property [] propertyArray;
property p;
properties newIssue;
 
p.property = "Type";
p.value = "{{issues.issueType.name}}";
propertyArray += p; 
p.property = "Data1";
p.value = "{{customfield_11111}}";
propertyArray += p; 
newIssue.properties += propertyArray;
 
string username = "user";
string password = "password";
HttpRequest request;
HttpHeader header = httpCreateHeader("Accept", "application/json");
request.headers += header; 
header = httpBasicAuthHeader(username, password);
request.headers += header; 
header = httpCreateHeader("Content-Type", "application/json");
request.headers += header;
41 returnData result = httpPost("https://xxxxx.yyyyy.org/db/hs/tikets/{{issue.key}}/updateinfo/", request, newIssue); 
return result.status;

Error is: Exception while executing SIL program >>null<<: [SIL Error on line: 41, column: 21] null

Appreciate any help.

BR,

Ivan

1 answer

1 accepted

0 votes
Answer accepted
Ivan D September 14, 2021

A solution is found.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events