How to call Rest APIs URLS from service-now from client appliaction using Angularjs

saran3
Kilo Contributor

I need a help about how to access service now tables to be accessed by inbound restapi url   to be   called at   C#.net based client application to retrieve,create,update and retrieve records using ANGULARJS.

        I have issue while accessing the REST URL for the table created on my service now instance and i tried to consume that URL to make call from .net client   application using angularJS for CRUD operation.it would be great that any one   made a call from client application to Service now before then kindly help me out to resolve this, where i had tried to made call from ay application it shows a error as "XMLHttpRequest cannot load http://xxxxx.service-now.com/api/now/table/<tablename>. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:55734' is therefore not allowed access." though i made recommended changes on request header as follows,which recommended for resolving this on many posts,

                            $http.defaults.headers.common['Access-Control-Allow-Origin'] = "*";

                      $http.defaults.headers.common['Access-Control-Allow-Headers'] = "X-Requested-With";

and also How to achieve or enable CORS(cross origin Resource sharing ),to make sure that client applications to access the rest apis without   an isssue.

Kindly help on this post....

6 REPLIES 6

saran3
Kilo Contributor

Hi All,



    i had created the Customized processor,with that processor form i can able to create record.Any how thanks for   this the advice.


Mwatkins
ServiceNow Employee
ServiceNow Employee

ServiceNow now supports CORS for the REST APIs, including the Table API and scripted REST web services. Other web service APIs, such as the SOAP API, do not support CORS. See the following links to get started:


CORS domain requirements


Define a CORS rule


REST API CORS support