Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Array = require('node-array');
- var request = require("request");
- username = "user24",
- password = "",
- auth = "Basic " + new Buffer(username + ":" + password).toString("base64");
- var options = { method: 'GET',
- 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",
- headers:
- {
- 'x-csrf-token': 'fetch',
- 'content-type': 'application/json',
- authorization: auth } };
- request(options, function (error, response, body) {
- if (error) throw new Error(error);
- // console.log(response.headers['x-csrf-token']);
- var token="'";
- token+=response.headers['x-csrf-token'];
- token+="'";
- //console.log(token);
- var options = { method: 'POST',
- url: 'http://207.188.73.88:8000/sap/opu/odata/sap/ZTEE_TIME_SRV/ZTEERESERVESet',
- headers:
- {
- authorization: auth,
- 'x-csrf-token': token,
- 'content-type': 'application/json' },
- body:
- { Time: 'time'PT11H00M00S'',
- Date: 'datetime'2014-03-11T00%3A00%3A00'',
- Location: 'AAJ',
- Number: 3 },
- json: true };
- request(options, function (error, response, body) {
- if (error) throw new Error(error);
- console.log(response.headers['x-csrf-token']);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement