Google Form Link Can't be accessed (/formResponse) - forms

First of all, sorry asking this question cause it's not about current topic
It's just about google form link that my expectation is I could open url with /formResponse
(Website Behaviour)
Request: When I try enter the link https://docs.google.com/forms/d/1WyFssMa_l1e_es9zSMJsojnqTA2AahmpfWiWknXr_P8/formResponse
Response: it will redirected to https://docs.google.com/forms/d/1WyFssMa_l1e_es9zSMJsojnqTA2AahmpfWiWknXr_P8/viewform
(HTTP Post Behaviour)
Request: (POST to https://docs.google.com/forms/d/1WyFssMa_l1e_es9zSMJsojnqTA2AahmpfWiWknXr_P8/formResponse)
Response: get an error like this:
Sorry, the file you have requested does not exist.
Anyone can help how to solve this? I appreciate if you get me out of this issue

I solved it when I used fetch from JavaScript
const opts = {
method: "POST",
mode: "no-cors",
redirect: "follow",
referrer: "no-referrer",
body: formData
}
fetch(url, opts)
...

Related

Puppeteer redirect throws ERR_BLOCKED_BY_CLIENT

I am using puppeteer to bring up chromium and launch a page. For my scenario the page URL has to be intercepted along with the css/js/img requests coming from the page.
My puppeteer code for page interception looks like this,
await page.setRequestInterception(true);
page.on("request", async (request: HTTPRequest) => {
if (request.url().endsWith(".html") ||
request.url().endsWith(".js") ||
request.url().endsWith(".css") ||
request.url().endsWith(".png")) {
let redirectUrl = await getNewUrl(request.url());
request.continue({ url: redirectUrl });
} else {
request.continue();
}
}
My initial HTML page load happens properly with the redirect URL.
Then the HTML page has a few browser requests the redirect URL is also fetched and the request is continued with redirect URL.
All the browser requests return an error looking like this,
I am still new to puppeteer and chrome extension development, kindly let me know if any way to figure out the issue here.
I am also suffering from same issue but I have a solution for this issue. If you are using ajax method and give static url path so remove this path and fix from dynamic path.

Facebook Webhook Test Button not working as expected

I have successfully added my callback url in my webhooks setup. At that time, the callback url was called successfully with proper logs and everything in the server. But when I click on the TEST button for the respective name (leadgen in this case), nothing AT ALL is being received by the server when in fact it should at least log the very first line. Note that I am using post and get.
Additional note: for NetSuite experienced developers, I am using a suitelet as the callback url for the webhook.
Thanks.
Suitelets that are available externally without login will only work if the User-Agent header in the request mimics a browser. See for example SuiteAnswers # 38695.
I ran into a similar issue, and the workaround was to proxy the request using a Google Cloud Function that simply rewrote the User Agent:
const request = require('request');
exports.webhook = (req, res) => {
request.post(
{
url: process.env.NETSUITE_SUITELET_URL,
body: req.body,
json: true,
headers: {
'User-Agent': 'Mozilla/5',
Authorization: req.headers['authorization'],
},
},
function(error, response, body) {
res.send(body);
}
);
};

Slim framework - email in url parameter

I have this code:
$app->group('/api', function(\Slim\App $app) {
$app->get('/user/{email}', \App\Server\Controller\UserController::class . ':get');
});
When I call this url: /api/user/name#domain.com, response is 404. the problem is in .com. Without this, response is 200 OK. How to add email address to url? thanks for advices

HTTP authorization headers not send with codeigniter api in ionic 2

In API they call without Authorization is fine.
How to set header for it?
"thanks"
let headers: Headers = new Headers({ 'Authorization': token, 'Content-Type': 'application/json; charset=UTF-8' });`
let options: RequestOptions = new RequestOptions({headers: headers});
let params: URLSearchParams = new URLSearchParams();
params.append('latitude', '23.259933');
params.append('longitude', '77.412615');
params.append('nearby', '5');
return this.http.post(baseUrl, params, options)
.map(
(response: Response)=>{
return response;
}
)
Chrome console:
Response for preflight has invalid HTTP status code 404
This happens because the browser sends the headers of your request to the server before sending the actual request (what is called preflight) so as to verify your request complies with the CORS policy that is defined in the server's configuration.
So what you need to do is double check that the server you are contacting is configured properly to accept the request as you make it.
Make sure that your backend server is accepting not only the POST request but also an OPTIONS request for the same endpoint url. The OPTIONS request should just return with the success 200 code.
On that server you probably have something like "when a user hits endpoint /abc with request type POST, then return some data". You also need something that says "when a user hits endpoint /abc with request type OPTIONS return 200 OK"
If all else fails you could try using this plugin in your browser, but keep in mind this will help only continuing development and is a band-aid solution that won't work in production of course.

Error while posting app request in Facebook using app login

I am trying to post an apprequest to a user using the URL:
https://graph.facebook.com/USER_ID/apprequests?message=’This is a new message from the pgm’&data='t1t2t3t4’&access_token=ACCESS_TOKEN_RECEIVED_FROM_FB&method=post
I am getting the following error:
Response Message Bad Request Response Code 400 App Request ID: 400 Bad Request
Method Not Implemented
Invalid method in request
Note: I got the access token and the same url works fine in the browser (Chrome).
Am I missing something? Couldn't find much in the documentation!
Regards
You need to url-encode your parameters. The browser does this transparently to you, that's why it's working there. Assuming you're using php:
http_build_query(array(
"message" => "This is a new message from the pgm",
"data" => "t1t2t3t4",
"access_token" => ACCESS_TOKEN_RECEIVED_FROM_FB,
"method" => "post"
));
This will take care of the encoding and joining parameters via amperstand characters. The return value is:
message=This+is+a+new+message+from+the+pgm&data=t1t2t3t4&access_token=ACCESS_TOKEN_RECEIVED_FROM_FB&method=post