Advertisement
Guest User

Untitled

a guest
Nov 24th, 2016
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. var request = require('request');
  2.  
  3.  
  4.  
  5. username = "",
  6. password = "",
  7. url = "http://207.188.73.88:8000/sap/opu/odata/sap/ZTEE_TIME_SRV/ZTEERESERVESet(Time=time'PT11H00M00S',Date=datetime'2014-03-11T00%3A00%3A00',Location='TAJ',Number=3)",
  8. auth = "Basic " + new Buffer(username + ":" + password).toString("base64");
  9.  
  10. request(
  11. {
  12. url : url,
  13.  
  14. headers : {
  15. "Authorization" : auth,
  16. 'x-csrf-token':'Fetch'
  17.  
  18. }
  19.  
  20. },
  21. function (error, response, body) {
  22. // console.log("JSON data " + response);
  23. // console.log("body" + body);
  24.  
  25. request(
  26. {
  27. url : url,
  28.  
  29. headers : {
  30.  
  31. "Authorization" : auth,
  32. "X-CSRF-TOKEN":"u6piLO58XoK6udOkQ5Naww=="
  33.  
  34. },
  35. method: 'POST',
  36. //Lets post the following key/values as form
  37. form: {
  38. Time:'PT11H00M00S',
  39.  
  40. Date:'2014-03-11T00%3A00%3A00',
  41. Location:'TAJ',
  42. Number:3 ,
  43. }
  44.  
  45. },
  46. function (error, response, body) {
  47. console.log(body);
  48. }
  49.  
  50.  
  51.  
  52.  
  53. );
  54. }
  55.  
  56.  
  57. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement