What is Namespace in integrations?

mallikharjunasw
Tera Contributor

What is Namespace in integrations?

1 ACCEPTED SOLUTION

G Balaji
Kilo Guru

Classes are grouped as namespaces.

In other words, Namespaces contain related classes which contains methods,

So, in REST API Explorer, to access a particular API method, the relevant class has to be chosen.

This is the simple definition of namespace.

For detailed technical understanding, above responses would certainly help you.

View solution in original post

7 REPLIES 7

Ruhi Jibhyenka1
Mega Guru

Hi, 

All scoped APIs run in a namespace that defines the scope of the API.

ServiceNow core APIs do not need a namespace qualifier. All other ServiceNow APIs are separated into different namespaces. This prevents naming collisions from APIs in different modules. This also helps ServiceNow provide new versions of the APIs. All ServiceNownamespaces in scoped applications follow the pattern: "sn_<module name>". To use these APIs, a fully qualified object name including its namespace is required. For example:
var restMessage = new sn_ws.RESTMessageV2();
An example for a static class:
var response = sn_cmdbgroup.CMDBGroupAPI.getManualCIList(groupSysId, false);

 

Check out  the below links for detailed information- 

https://developer.servicenow.com/app.do#!/training/article/app_store_learnv2_rest_kingston_inbound_integrations/app_store_learnv2_rest_kingston_selecting_an_api?v=kingston

https://developer.servicenow.com/app.do#!/document/content/app_store_doc_scoped_script_jakarta_c_applicationNamespace?v=kingston

https://docs.servicenow.com/bundle/geneva-custom-application-development/page/build/applications/concept/c_NamespaceIdentifier.html

Mark Correct if this solves your issue and also mark Helpful if response is worthy Thanks, Ruhi

SatheeshKumar
Kilo Sage

 

namespaces are typically employed for the purpose of grouping symbols and identifiers around a particular functionality and to avoid name collisions between multiple identifiers that share the same name

The system adds the namespace identifier to the front of all application tables, fields, and script names to uniquely identify the application artifacts.

As the application developer, you cannot change or remove the identifier from application artifacts. This ensures that application artifacts are associated to the proper application and that all application artifacts have a unique name.

Namespace identifiers have this format:

x_[Vendor prefix]_[Application ID]_

The system computes the application namespace identifier from the following elements:

Computing a namespace identifier
ElementRequirementsSample Value
The prefix character for custom applicationsThis string is always the x character.x
The separator character for namespace identifier prefixesThis string is always the underscore character. The separator also appears between other elements in the prefix._
The instance vendor prefix (glide.appcreator.company.code)This string is two to five characters long. ServiceNow generates this prefix for each customer. The instance stores the prefix in the glide.appcreator.company.code system property.acme
The application IDThis string can be up to 40 characters long. Typically the ID matches the application name with spaces replaced by underscores.book_rooms

The example values above generate a namespace identifier of x_acme_book_rooms.

Note: When you create a table or field, you cannot modify the namespace identifier but you can modify the rest of the name.
 
//copied from docs
 
-satheesh

G Balaji
Kilo Guru

Classes are grouped as namespaces.

In other words, Namespaces contain related classes which contains methods,

So, in REST API Explorer, to access a particular API method, the relevant class has to be chosen.

This is the simple definition of namespace.

For detailed technical understanding, above responses would certainly help you.

Thank you bro.