Hello i am new here so if i ask a stupid question please forgive me.
We at AppAtSchool are working with Google ApMaker and we want to call a published App with 2 parameters. How can we read those in App Maker? Thanks in advance!
I'm guessing, that you are trying to read page URL parameters. In this case you can pass parameters like this:
https://script.google.com/<SomeMagic>/exec/?param1=value1¶m2=value2#PageName
And then read them in page onAttach event(https://developers.google.com/appmaker/ui/logic#events):
google.script.url.getLocation(function(location) {
var params = location.parameter;
var param1 = params.param1;
var param2 = params.param2;
// Use parameters...
});
Maybe you also will need a way to genarate such links with parameters:
Integration between different Google Appmaker Apps
you can call your application with url something like this: script.google.com/blablabla/#viewname/paramValue, and take param on client side and send it to server side.
If you pass parameters to your App Maker app through URL parameters, your app can read the parameters using the google.script.url.getLocation method:
google.script.url.getLocation(function(location) {
console.log(location.parameters);
console.log(location.hash);
});
Find more details in the documentation
Related
I created a Web App with Telegram and ReactJS, after that I enabled web app debug mod to see inspect options.
The only way I can get user information is:
var search = Telegram.WebApp.initData
var converted = JSON.parse('{"' + search.replace(/&/g, '","').replace(/=/g,'":"') + '"}', function(key, value) { return key===""?value:decodeURIComponent(value) })
JSON.parse(converted.user)
Based on: https://core.telegram.org/bots/webapps#webappinitdata
But all the options the document calls are not there and there is another API which I need it is WebAppUser document, and again I can not access it.
My question is how can I be able to access it?
I see this JS file that Telegram says to add in our HTML, but I could not find the WebAppUser into it.
<script src="https://telegram.org/js/telegram-web-app.js"></script>
Short Video and demo: https://www.youtube.com/watch?v=rKFZd2rWk24
Thank you in advance.
I'm creating a web scraping bot in PhantomJs, I'm using onResourceReceived to sniff the the requests of the site and retrieve them using this simple code:
page.onResourceReceived = function(response)
{
if (response.url.match("XXXXXXX"))
{
console.log(response.url);
}
};
My problem is that response.url automatically update the data to a URL-decoded version of this. I need to check some parameters but instead of receiving something like this :
xxx.com?...&events=event20%2Cevent4%%2Cevent89%3D7%2Cevent50%2Cevent51%2Cevent52%2Cevent53%2Cevent54%2Cevent55%2Cevent56&...
I get this
xxx.com?... &events=event20%2Cevent4%2Cevent89%3D7&....
It looks like when %3D is reached it cuts the value and continues to the next property.
Is there a way to access the raw version of this data?
Thanks a lot for the help.
I need to use FQL to get user's current Facebook Chat status. Its not supported by Facebook Graph API.
"online_presence" parameter returns the user's Facebook Chat status as i studied on http://developers.facebook.com/docs/reference/fql/user
But i didn't find anything helpful which describe how i can use FQL in asp.net.
Can anyone show me an example how i can use FQL?
thanks
Hi you can use this sdk : http://facebooksdk.net/docs/web/getting-started/.
For use fql you need to do :
var client = new FacebookClient(THE_ACCESS_TOKEN);
dynamic me = client.Get("fql", new { q = "select online_presence from user where uid=me()"});
I let you parse the result and find how get the access token.
I'm developing a js single-page web application using a javascript client side mvc (angular.js in this case)
I added google analytic to the site, but from what I could see so far (at least in realtime) google doesn't take into account the part of the uri after the hash
that is I have a url like mydomain.com.ar/#/ideas/1 but for google analytics it looks just like mydomain.com.ar/
any idea?
You need to parse the parameters after # and send the data by using _trackPageview in order to see them on your pages report.
and here is how to do it,
var params = {},
queryString = location.hash.substring(1),
regex = /([^&=]+)=([^&]*)/g,
m;
while (m = regex.exec(queryString)) {
params[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
}
_gaq.push(['_trackPageview', queryString]);
Use $window dependency and call on route change.
Also use GA 'set' to ensure routes are picked up for Google realtime analytics.
$scope.$on('$routeChangeSuccess', function() {
$window.ga('set', 'page', $location.url());
$window.ga('send', 'pageview');
});
I am having an issue with call Drupal node.save using MooTool's JSONP. Here is an example.
Here is my request:
callback Request.JSONP.request_map.request_1
method node.save
sessid 123123123123123
node {"type":"blog","title":"New Title","body":"This is the blog body"}
Here is my result
HTTP/1.0 500 Internal Server Error
I got this working before, but i used AMFPHP and was able to send objects to drupal. I am assuming that this has to do with Drupal expecting an object, but since it is a GET it gets transformed as a string. Is there any way of getting around this with out hacking the code?
Here is my code:
$('newBlogSubmit').addEvent('click', function()
{
var node = {
type : "blog",
title:"New Title",
body :"This is the blog body"
}
var string = JSON.encode(node);
string.escapeRegExp()
var sessID = _sessID;
DrupalService.getInstance().node_save(string, sessID, drupal_handleBlogSubmit);
});
My Drupal Service JS Code:
//NODE
DrupalService.prototype.node_save = function(node, sessid, callback){
var dataObj = {
method : "node.save",
sessid : sessid,
node : node
}
DrupalService.getInstance().request(dataObj, callback);
}
//SEND REQUEST AND CALLBACK FUNCTION
DrupalService.prototype.request = function(dataObject, callback){
new JsonP('http://myDrupalSite.com/services/json', {data: dataObject,onComplete: callback}).request();
}
I am trying to connect the dots, but not too familiar with Drupal, but i would guess all I need to do is turn the string back into an object. Any ideas where I should be looking, or if there is an existing patch?
A first question could be why you use mootools since Drupal comes with jQuery and use it extensively throughout the different modules and Drupal core itself.
Anyways I don't know mootools so can't help you there, but if your request in ending in a internal server error, you have a problem with your drupal code or your js code. So even if I knew exactly what you were doing, I couldn't tell you the problem without looking at the drupal code for your http://myDrupalSite.com/services/json callback.
In general, what you want to make sure is:
You make a POST request, as drupal will cache get's and the semantic of this, is that you are posting data - the node - to the server.
Your data should be sent as post params, this will make them end up in the PHP $_POST variable
Your callback should validate the data and act accordingly, creating a node when the data is intact. You don't need session id's since the script will have the same session the browser has.
I've answered a similar question in detail, which was about altering a field instead of saving a node, but much of the work is still the same. You can take a look on the post, although this is with jQuery and not Mootools.