Rest Endpoint Dynamically Passing value !

Vivek Verma
Mega Sage
Mega Sage

I want to pass EndPoint dynamically, 

Like I am able to pass parameters via using ${} But I want the server name dynamically too.find_real_file.png

Here ${subid} passes value perfectly

But Servername ${rest_endpoint} wont working.

I have declared this value in Script include

var subid = "**********";

var rest_endpoint = "**********";

1 ACCEPTED SOLUTION

Ct111
Giga Sage

Hi,

 

You have to pass something like this in ur script include to make it work in REST

 

Below is the example of JIRA

 

 r.setStringParameter('base_endpoint', gs.getProperty('com.snc.integration.jira.base_jira_instance_url'));

 

 

Mark my ANSWER as CORRECT and HELPFUL if it helped

View solution in original post

7 REPLIES 7

use directly

 

below is the sample code if you wanna have a look

 

createIssue : function( issue ){
var json = new JSON();
var body = json.encode(issue);

var r = new RESTMessage('Jira Issue', 'post');
r.setBasicAuth(gs.getProperty('com.snc.integration.jira.jira_api_user'), gs.getProperty('com.snc.integration.jira.jira_api_password'));

this.debug("BODY to be Submitted: \n" + body);
r.setXMLParameter('issuebody', body);


r.setStringParameter('base_endpoint', gs.getProperty('com.snc.integration.jira.base_jira_instance_url'));

var res = this._submitBodyTypeRequest(r, true);

return res;
},

 

Mark my ANSWER as CORRECT and HELPFUL if it helped

Ct111
Giga Sage

Remember 'base_endpoint' is the parameter that you should keep for substitution in rest message .  And you define this in content like   ${base_endpoint}

 

find_real_file.png

 

 

Hope I am clear now 

 

Mark my ANSWER as CORRECT and HELPFUL if it helped

 

Prakhar Choubey
Tera Contributor

If i need to send additional comments / worknotes string value then what should i add script line in BR.
Please suggest me.

Thanks in an advance