RESTMessageV2 Syntax Explained

Justin Little
Tera Contributor

What is sn_ws in the syntax below? I understand RESTMessageV2() is a constructor based on ServiceNow’s documentation here: https://developer.servicenow.com/dev.do#!/reference/api/tokyo/server/c_RESTMessageV2API

 

What I don’t understand is why is sn_ws needed to call a constructor? What is sn_ws is it a class? 


var sm =
new sn_ws.RESTMessageV2();

1 ACCEPTED SOLUTION

Veer
Tera Guru

@Justin Little In ServiceNow, sn_ws stands for " ServiceNow Web Service". sn_ws.RestMessage is a class in the ServiceNow platform that represents a REST web service message. 

 

It's basically the name of the scope where RestMessage class has been created, in ServiceNow in order to access the classes it is required to prefix them with their scope name. hence sn_ws has been used whenever RestMessageV2 is been called.

Please mark this as an Accepted Solution / Helpful if it helps you.

View solution in original post

3 REPLIES 3

newhand
Mega Sage

@Justin Little 

I regard it as a class ...

Please mark my answer as correct and helpful based on Impact.

Veer
Tera Guru

@Justin Little In ServiceNow, sn_ws stands for " ServiceNow Web Service". sn_ws.RestMessage is a class in the ServiceNow platform that represents a REST web service message. 

 

It's basically the name of the scope where RestMessage class has been created, in ServiceNow in order to access the classes it is required to prefix them with their scope name. hence sn_ws has been used whenever RestMessageV2 is been called.

Please mark this as an Accepted Solution / Helpful if it helps you.

Justin Little
Tera Contributor

Thank you!!