user2858304
user2858304

Reputation: 1

http.get and http.post through error in scheduled script Netsuite - Error: Cannot find function post in object

I'm using schedule script and http.get method but throws error as "Cannot find function get in object". code snapshot:

var headers_= []
headers_["Content-Type"] = "application/x-www-form-urlencoded";
headers_["Accept"] = "appli`enter code here`cation/json";  
headers_["cache-control"] = "no-cache";

var response = http.get({
        url: URL_,          
        headers: headers_
    });

Upvotes: 0

Views: 517

Answers (1)

erictgrubaugh
erictgrubaugh

Reputation: 8857

Check your define statement. It should be:

define(["N/http"], function (http) {
  ...
});

If there are other dependencies as well, double-check that the order of the dependencies in the Array matches exactly the order of the parameters in the callback.

If the order matches exactly, make sure you don't have a typo in the parameter name you use for the http module.

Upvotes: 0

Related Questions