https://netsuiteprofessionals.com logo
#suitescript
Title
# suitescript
s

Simon

04/07/2022, 8:51 PM
I created a Restlet and tested it with Postman, everything is fine. The front end is done with React, they tried to called the Restlet and they got error. Reading the web, I see that I have to call a Suitelet, which will got the restlet... Is it the way it is ?
c

Craig

04/07/2022, 8:59 PM
I'm sure you can call the restlet directly
s

Simon

04/07/2022, 8:59 PM
But we get the CORS issue
c

Craig

04/07/2022, 9:05 PM
What are you doing to get a CORS issue?
s

Simon

04/07/2022, 9:06 PM
A simple call from React (Javascript) to Netsuite
c

Craig

04/07/2022, 9:06 PM
You probably need some auth headers in the call from react.
s

Simon

04/07/2022, 9:07 PM
Yes Keep in mind, Postman create it's own signature
e

Eric B

04/07/2022, 10:24 PM
I fixed the CORS issue by using the standard https GET and POST calls from the N/https module but since you're calling the RESTlet from React you probably won't benefit from that.
b

battk

04/08/2022, 12:55 AM
react is a little general, it now has variations that runs on differnt platforms
but in general a browser like context will have to deal with cross origin related issues
the external url for a restlet is meant to be used in server to server contexts