Accessing javascript open source API - javascript

how can i communicate with Mega.co.nz? They claim that they are using a open source java-script project that we (developers) can use to communicate with their server. But how does someone begin? I would really appreciate if i can get some tips on this.

API's are mostly designed for third-party developers' use so they usually provide documentations on how to connect to it (e.g. which URL's to call, what parameters to pass and what is the expected response.) Most of the time, you can find it on their website, if not, you should ask them for it.

As it states on the mega.co.nz developer page the API specification has not been documented yet. You would have to reverse engineer the HTML and javascript on the site to learn how to use it. Or wait until full documentation is available.

Related

How to feed read-only data from ClickUp API to Public Website

I'm not an experienced web developer so I'm having some issues connecting some dots with regards to ClickUp API (In my case) but it can be probably be more generalized as well.
I've been doing a bit of research, but can't seem to get exactly what I'm looking for which makes me think I'm missing something.
In my case, the goal is to make certian information on ClickUp publicly VEIWABLE (not writable) and format the html/css ourselves. This would be veiwable to strangers without requiring authentication with ClickUp in any way.
ClickUp provides public links and embedd options:
My attempt(JS): postMessage(content, url) and document.getElementById(frameID)
Issue: These will fail in browsers that enable that cross-origin protection thing. Forcing strangers to disable this security is not viable for us. I've also tried alloworigin, anyorigin, etc with no luck.
ClickUp API 2.0 for POST, GET, etc
Attempt: I wanted to use this unofficial JS wrapper https://www.npmjs.com/package/clickup.js but didn't write anything out yet.
Issues: From my understanding, this requires the stranger to authenticate with ClickUp before being able to read information. This would require server-side code.
Other issues: This read-only page is intended to be hosted on github which doesn't support server-side calls (from my understanding) so the solution I'm looking for may not exist.
The most straight-forward way I can think to solve this is the parsing embedded iframe method but the cross-origin problems kills it dead in the water. At this point, I'm stuck and would appreciate any additional feedback.
To formalize my question:
What architecture/pieces would I need to connect a front-end web page with private ClickUp information in a read-only fashion that allows front-end HTML/CSS modifications without user authentication?
My web development knowledge doesn't really go beyond javascript and maybe a tiny bit of PHP so if there's other tools available for this please let me know and I'll look into them.
Thanks for the time

From where am I supposed to install OpenSocial's gadgets.io?

I am trying to do this tutorial, http://developer.yahoo.com/yql/guide/yql-code-examples.html#yql_javascript
and it says to use gadgets.io, but does not say anything about installing it. Where do I get it from?
I should also say that I am trying to perform the query from a socket.io server.
gadgets.io is a javascript service exposed by the OpenSocial API which is available through OpenSocial containers. OpenSocial containers are used to host 3rd party web components known as gadgets and were originally contributed by Google.
There is no such thing as 'getting' the gadgets.io library, as it is exposed to gadgets running on a container. I'm not familiar with YQL, but I had a look at the link you provided and the code example they demonstrate is meant to be executed within some type of playground environment # Yahoo I guess - therefore their environment should support gadgets, i.e. an OpenSocial container.
Have a look at the original documentation of the gadgets.io.makeRequest in order to see similar examples. Hope it helps :)

Can I create a listener in JS instead of repeatedly requesting a URL?

I'm working on a tool that will require 'listening' for a response from the server.
Currently I've got the page using JQuery to request a URL and respond based on it's output.
I do that every couple seconds.
However, as there will likely be hundreds of people using the tool all at the same time, that could be a pretty big server load.
Is there a way I can create a 'listener' that will notify the loaded pages when a change happens instead of constantly querying the server?
I haven't really been able to find much on Google (probably not searching for the correct thing) so hopefully someone here will know exactly what I'm talking about.
Thanks in advance for your quick responses!
You are looking for technologies named Comet or server push. There are several different implementations of this problem, typically involving long-running, but idle HTTP connections. Check out Atmosphere (in Java) or various other libraries.
Also make sure to have a look at web sockets (new HTML5 technology).
See also
COMET javascript library

Google Safebrowsing checking JavaScript

Is it possible to extract a website safebrowsing info by javascript? This can be with Google Safe Browsing API, is there any code, or any article?
Related to your comment: This is not a code repository. You'll need to do your own development.
Back to your question: I would like to warn you that you will be exposing your API key to the general public when using javascript (as it's a client-side technology). Furthermore, you're opening the door to abusers. In the end, your "secret" API key might get suspended by Google quicker than you think.
In short: it could be done using the GET request examples the API documentation provides, but if I were you, I would think twice if javascript is really the best option you have.

How does disqus work?

Does anyone know how disqus works?
It manages comments on a blog, but the comments are all held on third-party site. Seems like a neat use of cross-site communication.
The general pattern used is JSONP
Its actually implemented in a fairly sophisticated way (at least on the jQuery site) ... they defer the loading of the disqus.js and thread.js files until the user scrolls to the comment section.
The thread.js file contains json content for the comments, which are rendered into the page after its loaded.
You have three options when adding Disqus commenting to a site:
Use one of the many integrated solutions (WordPress, Blogger, Tumblr, etc. are supported)
Use the universal JavaScript code
Write your own code to communicate with the Disqus API
The main advantage of the integrated solutions is that they're easy to set up. In the case of WordPress, for example, it's as easy as activating a plug-in.
Having the ability to communicate with the API directly is very useful, and offers two advantages over the other options. First, it gives you as the developer complete control over the markup. Secondly, you're able to process comments server-side, which may be preferable.
Looks like that using easyXDM library, which uses the best available way for current browser to communicate with other site.
Quoting Anton Kovalyov's (former engineer at Disqus) answer to the same question on a different site that was really helpful to me:
Disqus is a third-party JavaScript application that runs in your browser and injects itself on publishers' websites. These publishers need to install a small snippet of JavaScript code that makes the first request to our servers and loads initial JavaScript loader. This loader then creates all necessary iframe elements, gets the data from our servers, renders templates and injects the result into some element on the page.
As you can probably guess there are quite a few different technologies supporting what seems like a simple operation. On the back-end you have to run and scale a gigantic web application that serves millions of requests (mostly read). We use Python, Django, PostgreSQL and Redis (for our realtime service).
On the front-end you have to minimize your payload, make sure your app is super fast and that it doesn't break in extremely hostile environments (you will be surprised how screwed up publisher websites can be). Cross-domain communication—ability to send messages from hosting website to your servers—can be tricky as well.
Unfortunately, it is impossible to explain how everything works in a comment on Quora, or even in an article. So if you're interested in the back-end side of Disqus just learn how to write, run and operate highly-scalable websites and you'll be golden. And if you're interested in the front-end side, Ben Vinegar and myself (both front-end engineers at Disqus) wrote a book on the topic called Third-party JavaScript (http://thirdpartyjs.com/).
I'm planning to read the book he mentioned, I guess it will be quite helpful.
Here's also a link to the official answer to this question on the Disqus site.
short answer? AJAX, you get your own url eg "site.com/?comments=ID" included via javascript... but with real time updates like that you would need a polling server.
I think they keep the content on their site and your site will only send & receive the data to/from disqus. Now I wonder what happens if you decide that you want to bring your commenting in house without losing all existing comments!. How easy would you get to your data I wonder? They claim that the data belongs to you, but they have the control over it, and there is not much explanation on their site about this.
I'm always leaving comment in disqus platform. Sometimes, comment seems to be removed once you refreshed it and sometimes it's not. I think the one that was removed are held for moderation without saying it.

Categories

Resources