module.exports = {
main: function (event, context) {
console.log("this is new ");
var request = require("request");
var options = {
method: 'HEAD',
url: 'https://my300011.s4hana.ondemand.com/sap/opu/odata/SAP/API_MKT_CONTACT_SRV;v=0002/$metadata',
headers: {
'cache-control': 'no-cache',
Connection: 'keep-alive',
'Content-Length': '',
'Accept-Encoding': 'gzip, deflate',
Cookie: 'sap-usercontext=sap-client=100; SAP_SESSIONID_ZUZ_100=_UUr8oK5oyxO7hKSuKCoCmHhZD_DLxHpviD6Fj4LJJs%3d',
Host: 'my300011.s4hana.ondemand.com',
'Postman-Token': 'fcabc241-66b8-49ac-8be3-184fafbce600,41bfb188-7b81-41ec-b8c5-3e03ab19880b',
'Cache-Control': 'no-cache',
Accept: '*/*',
'User-Agent': 'PostmanRuntime/7.15.2',
Authorization: 'Basic Q09NTVVTRVJfSTMzOTcxMTpjakgmWnJNWlFWb1p2d3BnamtRYlF0QU1LVmZiR1JndTJvTm5yR2lS',
'x-csrf-token': 'fetch'
}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(response.headers['x-csrf-token']);
var request = require("request");
var options = {
method: 'POST',
url: 'https://my300011.s4hana.ondemand.com/sap/opu/odata/SAP/API_MKT_CONTACT_SRV;v=002/$batch',
headers: {
'cache-control': 'no-cache',
Connection: 'keep-alive',
'Content-Length': '866',
'Accept-Encoding': 'gzip, deflate',
Cookie: 'sap-usercontext=sap-client=100; SAP_SESSIONID_ZUZ_100=_UUr8oK5oyxO7hKSuKCoCmHhZD_DLxHpviD6Fj4LJJs%3d',
Host: 'my300011.s4hana.ondemand.com',
'Postman-Token': 'f6c4aeb2-d10b-4122-a39a-e4497c4d8c12,104d54ba-b11a-4415-b60c-04170b4e9630',
'Cache-Control': 'no-cache',
Accept: '*/*',
'User-Agent': 'PostmanRuntime/7.15.2',
Authorization: 'Basic X1NBUEkwNjU3OTk6QTVjJHgxb21BcWFtUmM0YVowQVU=,Basic Q09NTVVTRVJfSTMzOTcxMTpjakgmWnJNWlFWb1p2d3BnamtRYlF0QU1LVmZiR1JndTJvTm5yR2lS',
'Content-Type': 'multipart/mixed; boundary=batch',
'x-csrf-token': response.headers['x-csrf-token']
},
body: '--batch\r\nContent-Type:multipart/mixed; boundary=changeset_761e49b6-3146-4a57-8d10-15816fb9c75a\r\n\r\n--changeset_761e49b6-3146-4a57-8d10-15816fb9c75a\r\ncontent-type: application/http\r\ncontent-transfer-encoding: binary\r\n\r\nPUT ContactOriginData(ContactID=\'FA163E0B249B1ED9AD88E1EF57623521\',ContactOrigin=\'SAP_MANUAL\') HTTP/1.1\r\nContent-Length: 1035 \r\nAccept: application/json \r\nSap-Cuan-RequestTimestamp:\'2019-08-2T00:21:32\'\r\nSap-Cuan-SourceSystemType: EXT \r\nSap-Cuan-SourceSystemId: HYBRIS\r\nContent-Type: application/json\r\nSap-Cuan-ForceSynchronousProcessing:X\r\n\r\n{ \r\n "ContactOrigin": "SAP_MANUAL",\r\n "ContactID": "FA163E0B249B1ED9AD88E1EF57623521",\r\n "OriginDataLastChgUTCDateTime":"/Date(1566293852000)/",\r\n "FirstName":"Siby",\r\n "LastName":"Sabu",\r\n "EmailAddress":"siby.sabu1@sap.com"\r\n\r\n} \r\n \r\n\r\n--changeset_761e49b6-3146-4a57-8d10-15816fb9c75a--\r\n--batch--\r\n'
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(JSON.stringify(body));
});
});
}
}
{
"name": "cx-dend-api",
"dependencies": {
"@slack/client": "^5.0.1",
"@slack/webhook": "^5.0.0",
"axios": "^0.19.0",
"axios-cookiejar-support": "^0.5.0",
"cookie-parser": "~1.4.3",
"cors": "^2.8.5",
"debug": "~2.6.9",
"dotenv": "^8.0.0",
"express": "~4.16.0",
"http-errors": "~1.6.2",
"morgan": "~1.9.0",
"tough-cookie": "^3.0.1",
"request": "~2.88.0"
}
}