humza riaz
humza riaz

Reputation: 11

How to read Headers Parameter on server side "RESTLET"

    [I am trying to send parameter with GET request on RESTLET Netsuite !! 
    but i am continuously facing issue 403 forbidden when i am trying to concatenate parameter with URL , without parameter Request is working good and getting response but i want to send parameter so now i am trying to send parameter through Header but not able to read on server side !! please help me out .how to read request header values/parameters on Netsuite RESTLET.  

    1-first i tried concatenate with +"&name=asd" and then Uri builder throws error 403 forbidden
    2-Now i am sending parameters through request.header.add("name":"asd") working good  

This is my client side request code in which i am attaching parameters in request header

 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
    request.ContentType = "application/json";
    request.Method = "GET";
    request.Headers.Add(header);
    request.Headers.Add("email", "[email protected]");
    request.Headers.Add("password", "123-4567");
    WebResponse response = request.GetResponse();///here i got 403 on concatination ////






  function getCustomer(context)
          {
            var request =https.request.headers;///headers function not defined
             // var email =request.email;
              //var password = request.password;  
          }

Want to get header values on server side][1]

  [1]: https://i.sstatic.net/SEB68.png

Upvotes: 0

Views: 1116

Answers (1)

Avi
Avi

Reputation: 2069

In RESTlet you don't have access to request-headers, instead you get all the arguments passed to RESTlet in scriptContext(function argument to RESTlet entry point, get in current case).

Check this out on how to use RESTlet and how you can pass arguments.

Note: Add { "Content-Type": "application/json" } header since you want to pass data to RESTlet.

Upvotes: 2

Related Questions