[p2pu-dev] Redirection for API calls to an API_SERVER
Dan Diebolt
dandiebolt at gmail.com
Wed May 16 15:45:13 UTC 2012
Well if you are supporting JSONP my "same origin" point may be moot. In any
event I am a big proponent of client side functionality including allowing
users to post HTML and JavaScript to allow embedding of rich and dynamic
content within the platform. The lack of ability to integrate and embed
rich content is an enormous problem which drives users off-site,
disassociates content authors from their P2PU user identity and debrands
P2PU as many courses are essentially conducted outside P2PU's site.
I was encouraged when there was talk of using oembed and HTML5 postMessage
feature in the P2PU platform but those efforts are either incomplete or
stalled out. It would be fairly easy to come up with a "content embedding
API" that allows P2PU identity and external course content to flow back and
forth between the P2PU platform and embedded content from another domain as
this example shows:
http://p2pu.tk/
On Wed, May 16, 2012 at 10:47 AM, Jos Flores <josmasflores at gmail.com> wrote:
> Hey Dan,
>
> thanks for the feedback. That is a great point but currently the API
> is a layer on top of existing functionality so you could have the same
> services without going through the API. I think the original intent is
> to be able to serve API data without being a burden on the site.
>
> Good point though if at some stage we wanted to use some kind of
> backbone-like framework to create lighter views within the site. As
> you say, we would have to serve that data from the same origin,
> although the API can also provide JSONP so it might be usable this
> way?
>
> cheers,
> José
>
>
> On 16 May 2012 15:24, Dan Diebolt <dandiebolt at gmail.com> wrote:
> > If you use a different domain or subdomain for the API endpoint you will
> not
> > be able to call some API methods and consume the response from client
> side
> > code because of the same origin policy. Admittedly the API may not
> currently
> > have methods you want to call client side nor is there any way for a end
> > user to create client side javascript but if you offer these
> capabilities in
> > the future you don't want to the same origin policy block those efforts.
> >
> > On Wed, May 16, 2012 at 6:29 AM, Jos Flores <josmasflores at gmail.com>
> wrote:
> >>
> >> Hey guys,
> >>
> >> I have added a setting API_SERVER to be able to redirect calls to the
> >> API to a different machine if that setting is != None
> >>
> >> Could you guys have a look at the commit here:
> >>
> >>
> https://github.com/josmas/lernanta/commit/9ad44ffcc501bd8d4f5810e7b6deace95ff2a9a8
> >>
> >> Regarding a previous comment by Zuzel (not sure you are still around?)
> >> here:
> >>
> https://github.com/josmas/lernanta/commit/7f59a769581f2607c883db7dc0e1672fecc80faa#commitcomment-1227108
> >>
> >> I've decided against 404-ing p2pu.org/api because in that case we
> >> could not serve the API and the site under the same domain. API_SERVER
> >> is there for flexibility but I think for now we will be serving
> >> everything off the same server so we cannot 404 local calls.
> >>
> >> Could you guys let me know if you are happy with this and I will send
> >> a pull request? Any feedback appreciated!
> >>
> >> cheers,
> >> José
> >> _______________________________________________
> >> p2pu-dev mailing list
> >> p2pu-dev at lists.p2pu.org
> >> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
> >
> >
> >
> > _______________________________________________
> > p2pu-dev mailing list
> > p2pu-dev at lists.p2pu.org
> > http://lists.p2pu.org/mailman/listinfo/p2pu-dev
> >
> _______________________________________________
> p2pu-dev mailing list
> p2pu-dev at lists.p2pu.org
> http://lists.p2pu.org/mailman/listinfo/p2pu-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p2pu.org/pipermail/p2pu-dev/attachments/20120516/58e23c2e/attachment.html>
More information about the p2pu-dev
mailing list