Advertisement
Guest User

Untitled

a guest
Dec 14th, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. var Array = require('node-array');
  2. var request = require("request");
  3. username = "user24",
  4. password = "",
  5. auth = "Basic " + new Buffer(username + ":" + password).toString("base64");
  6. var options = { method: 'GET',
  7. url: "http://207.188.73.88:8000/sap/opu/odata/sap/ZTEE_SUGGEST_SRV/ZteeSuggestSet?$filter=Number eq 5 and Date eq datetime'2014-03-11T00%3A00%3A00'&$format=json",
  8. headers:
  9. {
  10.  
  11. 'x-csrf-token': 'fetch',
  12. 'content-type': 'application/json',
  13. authorization: auth } };
  14.  
  15. request(options, function (error, response, body) {
  16. if (error) throw new Error(error);
  17. // console.log(response.headers['x-csrf-token']);
  18. var token="'";
  19. token+=response.headers['x-csrf-token'];
  20. token+="'";
  21. //console.log(token);
  22. var options = { method: 'POST',
  23. url: 'http://207.188.73.88:8000/sap/opu/odata/sap/ZTEE_TIME_SRV/ZTEERESERVESet',
  24.  
  25. headers:
  26. {
  27. authorization: auth,
  28. 'x-csrf-token': token,
  29. 'content-type': 'application/json' },
  30. body:
  31. { Time: 'time'PT11H00M00S'',
  32. Date: 'datetime'2014-03-11T00%3A00%3A00'',
  33. Location: 'AAJ',
  34. Number: 3 },
  35. json: true };
  36.  
  37. request(options, function (error, response, body) {
  38. if (error) throw new Error(error);
  39.  
  40. console.log(response.headers['x-csrf-token']);
  41. });
  42.  
  43.  
  44.  
  45.  
  46. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement