How to authenticate N/https.get() so that it retri...
# ask-stanley-ai
a
How to authenticate N/https.get() so that it retrieves a NetSuite record page's HTML instead of a NetSuite login page.
c
AI generated answer (using internal Slack threads):
To authenticate N/https.get() so that it retrieves a NetSuite record page's HTML instead of a NetSuite login page, you need to understand that the Map/Reduce script does not have the login session, so it can't access internal NetSuite pages directly. However, you can use a workaround by creating a Suitelet or Restlet that has the required permissions to access the page. Then, you can call this Suitelet or Restlet from your Map/Reduce script. Here is a sample code snippet on how to call a Suitelet from a Map/Reduce script:
Copy code
javascript
var suiteletURL = url.resolveScript({
    scriptId: 'customscript_suiteletid',
    deploymentId: 'customdeploy_deploymentid',
    returnExternalUrl: true
});

var response = https.get({
    url: suiteletURL,
    headers: { "Content-Type": "application/json" }
});
In the above code, replace 'customscript_suiteletid' and 'customdeploy_deploymentid' with your Suitelet's script ID and deployment ID respectively. Please note that this is a workaround and may not be the best practice for all use cases. Always ensure that your Suitelet or Restlet has the necessary permissions and is secure. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829528809
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829040527
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.828857422
Please provide your feedback on this answer.
Thank you for your feedback
a
I already know how to make the request; I needed to authenticate it. But never mind - I found another way to retrieve the lastmodifieddate from a Revenue Recognition Rule. It can't be gotten via N/record or N/search, but it can be gotten via N/query.