I have an apache 2.4 server, which serves a file called resource.js.
When I request the resource, it returns an old page. My browser does not send an ETAG or Last-Modified header in the request, presumably because it doesn't have this resource cached.
Here's a snippet of the HAR when this happens
{
"startedDateTime": "2014-04-30T21:01:36.384Z",
"time": 0,
"request": {
"method": "GET",
"url": "https://someserver/resource.js",
"headers": [
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36"
}
],
"queryString": [],
"cookies": [],
"headersSize": -1,
"bodySize": 0
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Date",
"value": "Wed, 30 Apr 2014 20:46:57 GMT"
},
{
"name": "Last-Modified",
"value": "Thu, 24 Apr 2014 23:42:51 GMT"
},
{
"name": "Server",
"value": "Apache/2.4.4 (Unix) OpenSSL/1.0.1 PHP/5.4.12"
},
{
"name": "ETag",
"value": "\"e00-4f7d2684c7fb9\""
},
{
"name": "Content-Type",
"value": "application/javascript"
},
{
"name": "Connection",
"value": "Keep-Alive"
},
{
"name": "Accept-Ranges",
"value": "bytes"
},
{
"name": "Keep-Alive",
"value": "timeout=5, max=98"
},
{
"name": "Content-Length",
"value": "3584"
}
],
"cookies": [],
"content": {
"size": 3584,
"mimeType": "application/javascript",
"text": "...."
},
"redirectURL": "",
"headersSize": 318,
"bodySize": 0
},
"cache": {},
"timings": {
"blocked": -1,
"dns": -1,
"connect": -1,
"send": 0,
"wait": 0,
"receive": 0,
"ssl": -1
},
"connection": "48540",
"pageref": "page_1"
},
I know it's an old page, because I can verify the content of the page is not what is on the server. Also, note that the response returns an ETAG (that is wrong) and a Last-Modified date that's 7 days old when I modified this file today.
On the subsequent request though, the apache server returns the right page, after the ETAG and Last-Modified headers are submitted as part of the request:
{
"startedDateTime": "2014-04-30T21:03:02.771Z",
"time": 490.7269477844238,
"request": {
"method": "GET",
"url": "https://someserver/resource.js",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Cookie",
"value": "__utma=37592696.1580400495.1393617937.1393617937.1394060568.2; __utmz=37592696.1393617937.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); m=1933:60%7C5|2491:chart|34e2:|4e71:small"
},
{
"name": "Accept-Encoding",
"value": "gzip,deflate,sdch"
},
{
"name": "Host",
"value": "someserver"
},
{
"name": "Accept-Language",
"value": "en-US,en;q=0.8"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Cache-Control",
"value": "max-age=0"
},
{
"name": "If-None-Match",
"value": "\"e00-4f7d2684c7fb9\""
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "If-Modified-Since",
"value": "Thu, 24 Apr 2014 23:42:51 GMT"
},
{
"name": "Referer",
"value": "https://someserver"
}
],
"queryString": [],
"cookies": [
{
"name": "__utma",
"value": "37592696.1580400495.1393617937.1393617937.1394060568.2",
"expires": null,
"httpOnly": false,
"secure": false
},
{
"name": "__utmz",
"value": "37592696.1393617937.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)",
"expires": null,
"httpOnly": false,
"secure": false
},
{
"name": "m",
"value": "1933:60%7C5|2491:chart|34e2:|4e71:small",
"expires": null,
"httpOnly": false,
"secure": false
}
],
"headersSize": 667,
"bodySize": 0
},
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Date",
"value": "Wed, 30 Apr 2014 21:03:03 GMT"
},
{
"name": "Last-Modified",
"value": "Wed, 30 Apr 2014 21:01:19 GMT"
},
{
"name": "Server",
"value": "Apache/2.4.4 (Unix) OpenSSL/1.0.1 PHP/5.4.12"
},
{
"name": "ETag",
"value": "\"8bd-4f848d99ceae4\""
},
{
"name": "Content-Type",
"value": "application/javascript"
},
{
"name": "Connection",
"value": "Keep-Alive"
},
{
"name": "Accept-Ranges",
"value": "bytes"
},
{
"name": "Keep-Alive",
"value": "timeout=5, max=100"
},
{
"name": "Content-Length",
"value": "2237"
}
],
"cookies": [],
"content": {
"size": 2237,
"mimeType": "application/javascript",
"compression": 0,
"text": "..."
},
"redirectURL": "",
"headersSize": 321,
"bodySize": 2237
},
"cache": {},
"timings": {
"blocked": 2.418000000034226,
"dns": 69.07200000023295,
"connect": 182.09600000045612,
"send": 0.08100000013655517,
"wait": 235.99800000010873,
"receive": 1.0619477834552526,
"ssl": 181.40800000037416
},
"connection": "49670",
"pageref": "page_2"
},
And as expected, on the 3rd request, the ETAG and Last-Modified are good so the apache server sends back a 304 response code:
{
"startedDateTime": "2014-04-30T21:14:56.248Z",
"time": 138.21721076965332,
"request": {
"method": "GET",
"url": "https://someserver/resource.js",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "If-None-Match",
"value": "\"8bd-4f848d99ceae4\""
},
{
"name": "Accept-Encoding",
"value": "gzip,deflate,sdch"
},
{
"name": "Host",
"value": "someserver"
},
{
"name": "Accept-Language",
"value": "en-US,en;q=0.8"
},
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.131 Safari/537.36"
},
{
"name": "Accept",
"value": "*/*"
},
{
"name": "Referer",
"value": "https://someserver"
},
{
"name": "Cookie",
"value": "__utma=37592696.1580400495.1393617937.1393617937.1394060568.2; __utmz=37592696.1393617937.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); m=1933:60%7C5|2491:chart|34e2:|4e71:small"
},
{
"name": "Connection",
"value": "keep-alive"
},
{
"name": "If-Modified-Since",
"value": "Wed, 30 Apr 2014 21:01:19 GMT"
}
],
"queryString": [],
"cookies": [
{
"name": "__utma",
"value": "37592696.1580400495.1393617937.1393617937.1394060568.2",
"expires": null,
"httpOnly": false,
"secure": false
},
{
"name": "__utmz",
"value": "37592696.1393617937.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)",
"expires": null,
"httpOnly": false,
"secure": false
},
{
"name": "m",
"value": "1933:60%7C5|2491:chart|34e2:|4e71:small",
"expires": null,
"httpOnly": false,
"secure": false
}
],
"headersSize": 653,
"bodySize": 0
},
"response": {
"status": 304,
"statusText": "Not Modified",
"httpVersion": "HTTP/1.1",
"headers": [
{
"name": "Date",
"value": "Wed, 30 Apr 2014 21:14:56 GMT"
},
{
"name": "ETag",
"value": "\"8bd-4f848d99ceae4\""
},
{
"name": "Server",
"value": "Apache/2.4.4 (Unix) OpenSSL/1.0.1 PHP/5.4.12"
},
{
"name": "Connection",
"value": "Keep-Alive"
},
{
"name": "Keep-Alive",
"value": "timeout=5, max=100"
}
],
"cookies": [],
"content": {
"size": 2237,
"mimeType": "application/javascript",
"text": "..."
},
"redirectURL": "",
"headersSize": 203,
"bodySize": 0
},
"cache": {},
"timings": {
"blocked": 5.732999999963795,
"dns": -1,
"connect": -1,
"send": 0.07100000038917642,
"wait": 118.89599999994971,
"receive": 13.51721076935064,
"ssl": -1
},
"connection": "51334",
"pageref": "page_1"
},
If anyone knows why the first request returns the wrong page, please let me know.
Related
I am trying to get button's link from message of gmail (ex. verify account button). Is there any way to make it via Google API?
I used Api to get all messages first: https://www.googleapis.com/gmail/v1/users/me/messages
Then used this api to get the message details: https://www.googleapis.com/gmail/v1/users/me/messages/{message_id}
but can't find the link inside the email body, here is the response!!
{
"id": "1785a64978e454be",
"threadId": "1785a528dc1e905c",
"labelIds": [
"IMPORTANT",
"CATEGORY_PERSONAL",
"INBOX"
],
"snippet": "Invesna Logo Hello Turki Thank you for joining our community Best wishes INVESNA Team Verify Now This is an automated email. If you've received this email by mistake, please",
"payload": {
"partId": "",
"mimeType": "multipart/alternative",
"filename": "",
"headers": [
{
"name": "Delivered-To",
"value": "areeb.*****#gmail.com"
},
{
"name": "Received",
"value": "by 2002:a6b:916:0:0:0:0:0 with SMTP id t22csp3887526ioi; Mon, 22 Mar 2021 07:44:05 -0700 (PDT)"
},
{
"name": "X-Google-Smtp-Source",
"value": "ABdhPJyvgEKiYNby+5oLp9d6ZLU4ujfWHmppkGFvw2POAHup5hfkbaexaDRj9bwjk1zLmhyuIfsq"
},
{
"name": "X-Received",
"value": "by 2002:ac8:4752:: with SMTP id k18mr234477qtp.158.1616424245098; Mon, 22 Mar 2021 07:44:05 -0700 (PDT)"
},
{
"name": "ARC-Seal",
"value": "i=1; a=rsa-sha256; t=1616424245; cv=none; d=google.com; s=arc-20160816; b=cTBJJWs+fBO2mU4nAKoz+VzfvNI7RrAW3PKApijZ0LI4v6Ma1XAQxKilc+IEiwcmFE D6cTkU9CVAS9f+IOaE3bb8NCnQVz7mFvFkD72vvDeWaMsW2V2jbKZoFPdFKDGZ6b70fq WUXxy5uCHkafF9gAtmPFU2eTfMRRk5uv3ZA8XGcO87JWSYngzz/DoOdD6cQOVfIiv4HF YGAITJGHTYL2kgwdRVlSJCKQBpQZIJqM3pUHaYJ3+uXs2rg1XkaLyFudF3brG7tKUOMN gCXsyINhAfuTw2bIrWmSX+8B3AHG+h+aQfTbl9GNr3oBLYYM7BRMSfG2S8jldm6XnEpM ZUEg=="
},
{
"name": "ARC-Message-Signature",
"value": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:mime-version:to:from:subject:date:message-id :dkim-signature:dkim-signature; bh=RToLBuWpZqa2f+3AtVt2tvS0pNeSTnAA4DQnGQ8mMWU=; b=prTkhBY/VOg77E8LDGE3HZD7rGb2vQuG2uln53Jh3ee4fXIKZtB6RwVUjBrodFyb6S FXUbY0Iox/TWv+Maqr0p89waYhGYy/aQD4g6G3/8BwLSCqAOc65JsKMGwGor/t2ZdsOZ w97c2w3eswYEfu9FuhXyCLV9Jbg/4bw32JWb59mKuAQSKx6aeiipXShmPmAmI5FWxlmu y/dbft5H4weUd3jXQjbAqXnfzyEso+nbl2iexfobZ4vqRPzarwk9tSZEC73mgqbsA5ZF zx9xPOYxJbMVin5Wrsit0p8xVv3DD1UlPGqNCItAviqUkHqtUDkznPmiWpFXtXLxoyk2 3SyA=="
},
{
"name": "ARC-Authentication-Results",
"value": "i=1; mx.google.com; dkim=pass header.i=#areebgroup.com header.s=ly5fxy3f4dncdbipp3gron65eulkyt3p header.b=XztlZ3Jb; dkim=pass header.i=#amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=FtocR6ro; spf=pass (google.com: domain of 010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000#amazonses.com designates 54.240.48.108 as permitted sender) smtp.mailfrom=010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000#amazonses.com"
},
{
"name": "Return-Path",
"value": "<010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000#amazonses.com>"
},
{
"name": "Received",
"value": "from a48-108.smtp-out.amazonses.com (a48-108.smtp-out.amazonses.com. [54.240.48.108]) by mx.google.com with ESMTPS id cj6si7995790qvb.74.2021.03.22.07.44.04 for <areeb.testing2#gmail.com> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Mon, 22 Mar 2021 07:44:05 -0700 (PDT)"
},
{
"name": "Received-SPF",
"value": "pass (google.com: domain of 010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000#amazonses.com designates 54.240.48.108 as permitted sender) client-ip=54.240.48.108;"
},
{
"name": "Authentication-Results",
"value": "mx.google.com; dkim=pass header.i=#areebgroup.com header.s=ly5fxy3f4dncdbipp3gron65eulkyt3p header.b=XztlZ3Jb; 18-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000#amazonses.com"
},
{
"name": "DKIM-Signature",
"value": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ly5fxy3f4dncdbipp3gron65eulkyt3p; d=areebgroup.com; t=1616424244; h=Message-ID:Date:Subjec"
},
{
"name": "DKIM-Signature",
"value": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1616424244; h=Message-ID:Date:Subject:Fro"
},
{
"name": "Message-ID",
"value": "<010001785>
},
{
"name": "Date",
"value": "Mon, 22 Mar 2021 14:44:04 +0000"
},
{
"name": "Subject",
"value": "Verify Your Account"
},
{
"name": "From",
"value": "Invesna <account#aree>"
},
{
"name": "To",
"value": "areeb.**#gmail.com"
},
{
"name": "MIME-Version",
"value": "1.0"
},
{
"name": "Content-Type",
"value": "multipart/alternative; boundary=\"_=_swift_1616424243_8452744c94a6060ff23d75c5b712dcb6_=_\""
},
{
"name": "X-SES-Outgoing",
"value": "2021.03.22-54.240.48.108"
},
{
"name": "Feedback-ID",
"value": "1.us-ea"
}
],
"body": {
"size": 0
},
"parts": [
{
"partId": "0",
"mimeType": "text/plain",
"filename": "",
"headers": [
{
"name": "Content-Type",
"value": "text/plain; charset=utf-8"
},
{
"name": "Content-Transfer-Encoding",
"value": "quoted-printable"
}
],
"body": {
"size": 5094,
"data": "PCFET0NUWVBFIGh0bWw-DQo8aHRtbCBsYW5nPSJlbiI-DQo8Ym9keT4NCjxkaXYgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmN2Y5ZmM7IHBhZGRpbmctYm90dG9tOiAzcmVtIj4NCiAgICA8aW1nIHNyYz0iaHR0cDovL2FwaS10ZXN0LmludmVzbmEud9JbnZlc25hX2FwcCIgdGFyZ2V0PSJfYmxhbmsiPg0KICAgICAgICAgICAgICAgICAgICAgICAgPGltZw0KICAgICAgICAgICAgPg0KPC9ib2R5Pg0KPC9odG1sPg0K"
}
},
{
"partId": "1",
"mimeType": "text/html",
"filename": "",
"headers": [
{
"name": "Content-Type",
"value": "text/html; charset=utf-8"
},
{
"name": "Content-Transfer-Encoding",
"value": "quoted-printable"
}
],
"body": {
"size": 10026,
"data": "PCFkb2N0eXBlIGh0bWw-DQo8aHRtbCBsYW5nPSJlbiI-PGJvZHkgc3R5bGU9ImZvbnQtZmFtaWx5OiAtYXBwbGUtc3lzdGVtLCBCbGlua01hY1N5c3RlbUZvbnQsICdTZWdvZSBVSScsIFJvYm90bywgSGVsdmV0aWNhLCBBcmlhbCwgc2Fucy1zZXJpZiwgJ0FwcGxlIENvbG9yIEVtb2ppgYWx0PSJQYXR0ZXJuIiBzdHlsZT0iZm9udC1mYW1pbHk6IC1hcHBsZS1zeXN0ZW0sICAgICAgPC91bD4NCjwvZGl2Pg0KICAgIDwvZGl2Pg0KPC9kaXY-DQo8L2JvZHk-PC9odG1sPg0K"
}
}
]
},
"sizeEstimate": 20887,
"historyId": "79",
"internalDate": "16164240"
}
Resolved, my email body was encoded by base64 encoder, i decode it first then i found the link i need
Reference:
Resource: MessagePartBody
we are receiving errors from the HERE map tiles rest API, but the error is only when trying to get the map tiles with a computer located in Florida. From a computer located in Israel, everything is fine.
Any known issue?
See below -
"_priority": "High",
"_resourceType": "image",
"cache": {},
"pageref": "page_1",
"request": {
"method": "GET",
"url": "https://3.aerial.maps.cit.api.here.com/maptile/2.1/maptile/newest/satellite.day/15/9050/13824/256/png8?app_id=XXX=eng",
"httpVersion": "",
"headers": [
{
"name": ":method",
"value": "GET"
},
{
"name": ":authority",
"value": "3.aerial.maps.cit.api.here.com"
},
{
"name": ":scheme",
"value": "https"
},
{
"name": ":path",
"value": "/maptile/2.1/maptile/newest/satellite.day/15/9050/13824/256/png8?app_id=XXX=eng"
},
{
"name": "user-agent",
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36"
},
{
"name": "accept",
"value": "image/avif,image/webp,image/apng,image/*,*/*;q=0.8"
},
{
"name": "sec-fetch-site",
"value": "cross-site"
},
{
"name": "sec-fetch-mode",
"value": "no-cors"
},
{
"name": "sec-fetch-dest",
"value": "image"
},
{
"name": "referer",
"value": "https://eu.percepto.co/"
},
{
"name": "accept-encoding",
"value": "gzip, deflate, br"
},
{
"name": "accept-language",
"value": "en-US,en;q=0.9"
}
],
"queryString": [
{
"name": "app_id",
"value": "XXX"
},
{
"name": "app_code",
"value": "XXX"
},
{
"name": "lg",
"value": "eng"
}
],
"cookies": [],
"headersSize": -1,
"bodySize": 0
},
"response": {
"status": 0,
"statusText": "",
"httpVersion": "",
"headers": [],
"cookies": [],
"content": {
"size": 0,
"mimeType": "x-unknown"
},
"redirectURL": "",
"headersSize": -1,
"bodySize": -1,
"_transferSize": 0,
"_error": "net::ERR_ABORTED"
},
"serverIPAddress": "",
"startedDateTime": "2020-11-30T18:10:30.325Z",
"time": 1.3352910000830889,
"timings": {
"blocked": 1.3352910000830889,
"dns": -1,
"ssl": -1,
"connect": -1,
"send": 0,
"wait": 0,
"receive": 0,
"_blocked_queueing": -1
}
},
Sometimes HERE services are down in some region and you can see the status of the services at this link:
HERE System Status
I am working on a Shopify React Native app. I am trying to create a new customer with my app. It is working fine on Postman but not working with my app.
app.
I have also setup my private app on shopify and get all the required credentials from there.
I am posting my code here.
let requestdata =
{
method: 'POST',
headers:
{
'Authorization':'Basic ' + base64.encode('apikey' + ":" +
'password'),
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"customer": {
"first_name": "test",
"last_name": "user",
"email": "testuser#example.com",
"phone": "+15154346011",
"verified_email": true,
"addresses": [
{
"address1": "123 Oak St",
"city": "Ottawa",
"province": "ON",
"phone": "+15154346011",
"zip": "123 ABC",
"last_name": "user",
"first_name": "test",
"country": "CA"
}
]
}}),
};
fetch('https://apikey:password#domainname/admin/api/2020-
04/customers.json', requestdata)
.then(res => {
console.log("resoponse",JSON.stringify(res))
this.setState({
data:res
})
}).catch((err)=>{
console.log(err)
})
}
Here i am also attaching image of response i am getting.
{
"type": "default",
"status": 200,
"ok": true,
"headers": {
"map": {
"referrer-policy": "origin-when-cross-origin",
"cache-control": "no-cache, no-store",
"x-request-id": "fe78c2cb-1f8e-4cbc-815b-7a9aef11145e",
"cf-request-id": "0344067c9e00000f82b3286200000001",
"set-cookie": "_y=5de13f45-35f4-46a9-92f2-502b08a7ab8e; Expires=Fri, 11-Jun-21 08:09:37 GMT; Path=/, request_method=; path=/; max-age=0; expires=Thu, 01 Jan 1970 00:00:00 GMT, _shopify_y=5de13f45-35f4-46a9-92f2-502b08a7ab8e; Expires=Fri, 11-Jun-21 08:09:37 GMT; Path=/",
"x-shardid": "41",
"x-shopify-login-required": "true",
"expect-ct": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"",
"x-dc": "gcp-us-east1,gcp-us-central1,gcp-us-central1",
"x-xss-protection": "1; mode=block; report=/xss-report?source%5Baction%5D=login&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Fauth&source%5Bsection%5D=admin&source%5Buuid%5D=fe78c2cb-1f8e-4cbc-815b-7a9aef11145e",
"x-sorting-hat-podid": "41",
"content-type": "text/html; charset=utf-8",
"x-frame-options": "DENY",
"x-download-options": "noopen",
"vary": "Accept-Encoding",
"date": "Thu, 11 Jun 2020 08:09:37 GMT",
"nel": "{\"report_to\":\"network-errors\",\"max_age\":2592000,\"failure_fraction\":0.01,\"success_fraction\":0.0001}, {\"report_to\":\"network-errors\",\"max_age\":2592000,\"failure_fraction\":0.01,\"success_fraction\":0.0001}",
"server": "cloudflare",
"x-content-type-options": "nosniff",
"x-shopify-stage": "production",
"report-to": "{\"group\":\"network-errors\",\"max_age\":2592000,\"endpoints\":[{\"url\":\"https://monorail-edge.shopifycloud.com/v1/reports/nel/20190325/shopify\"}]}, {\"group\":\"network-errors\",\"max_age\":2592000,\"endpoints\":[{\"url\":\"https://monorail-edge.shopifycloud.com/v1/reports/nel/20190325/shopify\"}]}",
"cf-cache-status": "DYNAMIC",
"alt-svc": "h3-27=\":443\"; ma=86400",
"x-shopid": "27371339818",
"shopify-auth-mechanisms": "password",
"content-language": "en",
"cf-ray": "5a19d9da9dab0f82-MXP",
"x-sorting-hat-shopid": "27371339818"
}
},
"url": "https://apikey:password#domainname.myshopify.com/admin/auth/login",
"_bodyInit": {
"_data": {
"size": 1323,
"offset": 0,
"blobId": "0e0582a6-41ee-4cac-a1c4-b651149cc87f",
"__collector": {}
}
},
"_bodyBlob": {
"_data": {
"size": 1323,
"offset": 0,
"blobId": "0e0582a6-41ee-4cac-a1c4-b651149cc87f",
"__collector": {}
}
}
}
And this is the response i am getting from postman:
{
"customer": {
"id": 3028204847146,
"email": "testuser#example.com",
"accepts_marketing": false,
"created_at": "2020-06-14T15:59:02+05:30",
"updated_at": "2020-06-14T15:59:02+05:30",
"first_name": "test",
"last_name": "user",
"orders_count": 0,
"state": "disabled",
"total_spent": "0.00",
"last_order_id": null,
"note": null,
"verified_email": true,
"multipass_identifier": null,
"tax_exempt": false,
"phone": "+15154346011",
"tags": "",
"last_order_name": null,
"currency": "INR",
"addresses": [
{
"id": 3226192674858,
"customer_id": 3028204847146,
"first_name": "test",
"last_name": "user",
"company": null,
"address1": "123 Oak St",
"address2": null,
"city": "Ottawa",
"province": "Ontario",
"country": "Canada",
"zip": "123 ABC",
"phone": "+15154346011",
"name": "test user",
"province_code": "ON",
"country_code": "CA",
"country_name": "Canada",
"default": true
}
],
"accepts_marketing_updated_at": "2020-06-14T15:59:02+05:30",
"marketing_opt_in_level": null,
"tax_exemptions": [],
"admin_graphql_api_id": "gid://shopify/Customer/3028204847146",
"default_address": {
"id": 3226192674858,
"customer_id": 3028204847146,
"first_name": "test",
"last_name": "user",
"company": null,
"address1": "123 Oak St",
"address2": null,
"city": "Ottawa",
"province": "Ontario",
"country": "Canada",
"zip": "123 ABC",
"phone": "+15154346011",
"name": "test user",
"province_code": "ON",
"country_code": "CA",
"country_name": "Canada",
"default": true
}
}
}
I asked this question also in the node-red forum, but there is not much activity (compared to stackoverflow). So I try it here again. The motivation of my question is, that I sometime loose the connection to an OPC-UA-Server that requires restart of the flow to work again. I want to do this automatically in background, because the rare restart of the flow is no big issue - so I can live with it.
There is a thread https://discourse.nodered.org/t/how-to-restart-flows-automatically/12993 that is not really finished or solved.
I implemented the last example, but get error 400, so automatic restart of flow doesn't work. Is there any fool proof description how to do this?
EDIT:
This is the code:
[
{
"id": "3623f8cf.b4d2b8",
"type": "subflow",
"name": "restart flows",
"info": "",
"category": "",
"in": [
{
"x": 40,
"y": 80,
"wires": [
{
"id": "f24fbf79.77a74"
}
]
}
],
"out": [
{
"x": 960,
"y": 80,
"wires": [
{
"id": "cb4d3992.931138",
"port": 0
}
]
}
],
"env": [
{
"name": "user",
"type": "str",
"value": ""
},
{
"name": "password",
"type": "str",
"value": ""
}
],
"color": "#FF8888",
"inputLabels": [
"Injection"
],
"icon": "node-red/alert.svg"
},
{
"id": "f24fbf79.77a74",
"type": "function",
"z": "3623f8cf.b4d2b8",
"name": "Request Token",
"func": "var user = env.get('user');\nvar pass = env.get('password');\n\nif(user === undefined || user === null)\n{\n user = 'adminuser';\n}\nif(pass === undefined || pass === null)\n{\n pass = 'adminpass';\n}\n\nmsg.payload = {\n \"client_id\": \"node-red-editor\",\n \"grant_type\": \"password\",\n \"scope\": \"*\",\n \"username\": user,\n \"password\": pass\n}\nreturn msg;\n\n/*\nmsg.payload = {\n \"client_id\": \"node-red-editor\",\n \"grant_type\": \"password\",\n \"scope\": \"*\",\n \"username\": \"type or username\",\n \"password\": \"type your password\"\n}\nreturn msg;\n*/",
"outputs": 1,
"noerr": 0,
"x": 200,
"y": 80,
"wires": [
[
"3aedf561.e16f4a"
]
]
},
{
"id": "3aedf561.e16f4a",
"type": "http request",
"z": "3623f8cf.b4d2b8",
"name": "Token",
"method": "POST",
"ret": "txt",
"paytoqs": false,
"url": "http://servername:port/auth/token",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 390,
"y": 80,
"wires": [
[
"388fe2f5.639eee"
]
]
},
{
"id": "388fe2f5.639eee",
"type": "function",
"z": "3623f8cf.b4d2b8",
"name": "Confirm token",
"func": "// get the status of the request\nvar status = msg.statusCode;\nvar token = '';\nmsg.headers ={};\n\n//let node = feedback;\n\nswitch(status){\n case 200:\n node.log(\"Secure restart\");\n token = JSON.parse(msg.payload);\n token = 'Bearer '+token.access_token;\n msg.headers = {\n \"Authorization\": token,\n \"Node-RED-Deployment-Type\":\"reload\"\n }\n msg.payload =\"\";\n break;\n case 204:\n node.log(\"Secure without restart\");\n global.set('result','\tSuccess - with no further content');\n break;\n case 400:\n node.warn(\"Bad request\");\n break;\n case 401:\n node.warn(\"Not authorized\");\n break;\n case 403:\n node.warn(\"Forbidden\");\n break;\n case 404:\n node.log(\"Unsecure restart\");\n msg.headers = {\n \"Node-RED-Deployment-Type\":\"reload\"\n }\n break;\n case 409:\n node.warn(\"Version mismatch\");\n break;\n case 500:\n node.error(\"Server Error\");\n break;\n default:\n node.warn(\"Unknown Error\");\n break;\n}\n\nmsg.payload = \"\";\n\nsetTimeout(function() { node.send(msg) }, 10000);\n\nreturn null;",
"outputs": 1,
"noerr": 0,
"x": 580,
"y": 80,
"wires": [
[
"cb4d3992.931138"
]
],
"info": "Restart of Node-Red flows.\nWill check if the action needs security or not.\nNote: if the first 5 attemps return a statuscode 403 'forbidden'\nthen the server will break and only way to recover is then to\nrestart the service"
},
{
"id": "cb4d3992.931138",
"type": "http request",
"z": "3623f8cf.b4d2b8",
"name": "Restart",
"method": "POST",
"ret": "txt",
"paytoqs": false,
"url": "http://servername:port/flows",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 780,
"y": 80,
"wires": [
[]
]
}
]
The settings.js file is as follows:
adminAuth: {
type: "credentials",
users: [
{
username: "adminuser",
password: "adminpass",
permissions: "*"
},
Hope this helps.
I am using bot framework v4. I have developed a chatbot using .Net Core. The bot is integrated with LUIS and Qna Maker. One issue I am facing is that the bot duplicates the message that comes from the user. Please look at the screenshot below:
The replies I get from the bot are perfectly fine. The flow of the bot is as intended. I just cannot figure out why the message from user is being duplicated. I am using DirectLine for this. I will share whatever code part is needed.
{
"activities": [
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000000",
"timestamp": "2019-12-02T19:41:57.1284328Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "Image",
"size": "large",
"url": "https://i.imgur.com/ViaEUnA.png"
}
]
}
],
"horizontalAlignment": "Center"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "auto",
"items": [
{
"type": "TextBlock",
"size": "large",
"weight": "bolder",
"color": "light",
"text": "Welcome to CIVIC Financial Services",
"wrap": true
},
{
"type": "TextBlock",
"size": "large",
"weight": "bolder",
"color": "light",
"text": "I am S.U.E",
"wrap": true
},
{
"type": "TextBlock",
"color": "light",
"text": "I can help you answer your questions. Familiarize yourself with CIVIC Financial Services.",
"wrap": true
},
{
"type": "TextBlock",
"color": "light",
"text": "If you want to talk to a Customer Service Agent, just type \"I want to talk to a Customer Service Agent\".",
"wrap": true
}
],
"separator": true,
"horizontalAlignment": "Left"
}
]
}
]
}
],
"actions": [
{
"type": "Action.Submit",
"data": {
"action": "aboutCivic"
},
"title": "About CIVIC"
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"actions": [
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "We are open from Monday through Friday from 8:00am to 6:00pm.",
"wrap": true
}
],
"style": "emphasis"
},
"title": "When are you open?"
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "Image",
"size": "stretch",
"url": "https://i.imgur.com/gBVgI25.png",
"horizontalAlignment": "center"
},
{
"type": "TextBlock",
"text": "AZ, CA, CO, FL, GA, HI, NC, NV, OR, SC, TN, TX, UT, VA & WA",
"wrap": true
}
],
"style": "emphasis"
},
"title": "Do you have an office near me? "
},
{
"type": "Action.ShowCard",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "8 to 10 days, it all depends on how it takes to get access to the property.",
"wrap": true
}
],
"style": "emphasis"
},
"title": "How quickly can we close? "
}
],
"style": "emphasis"
},
"title": "FAQs"
}
]
}
}
],
"entities": [],
"replyToId": "8WGOnspSxN3"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000001",
"timestamp": "2019-12-02T19:43:39.96502Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"entities": [
{
"type": "ClientCapabilities",
"requiresBotState": true,
"supportsListening": true,
"supportsTts": true
}
],
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000002",
"timestamp": "2019-12-02T19:43:41.7278914Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Sorry, I didn't understand. Consider rephrasing your question or contacting a customer agent",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000001"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000003",
"timestamp": "2019-12-02T20:00:25.784598Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "helo",
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000004",
"timestamp": "2019-12-02T20:00:26.5739342Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Sorry, I didn't understand. Consider rephrasing your question or contacting a customer agent",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000003"
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000005",
"timestamp": "2019-12-02T20:00:27.3293896Z",
"serviceUrl": "https://directline.botframework.com/",
"channelId": "directline",
"from": {
"id": "r_1575315715",
"name": "",
"role": "user"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"textFormat": "plain",
"locale": "en-GB",
"text": "hello",
"channelData": {
"siteDomain": "https://websiteae1.stackblitz.io/"
}
},
{
"type": "message",
"id": "BR1wBZw7w2852JMLobk0EC-o|0000006",
"timestamp": "2019-12-02T20:00:27.6064185Z",
"channelId": "directline",
"from": {
"id": "CivicDevBot",
"name": "CivicChat"
},
"conversation": {
"id": "BR1wBZw7w2852JMLobk0EC-o"
},
"text": "Hello",
"inputHint": "acceptingInput",
"attachments": [],
"entities": [],
"replyToId": "BR1wBZw7w2852JMLobk0EC-o|0000005"
}
],
"watermark": "6"
}