Jump to content
Graham Quince

Understanding Frog's APIs

Recommended Posts



I've tried to write it for those of you who understand code, but have never tried to access an API. Before I joined Frog, I had never been successful in using APIs. I'm sure users like JElliott * will find this insultingly simple and be appalled at the poor use of coding terms (I don't mention the DOM once). 

For the rest of us mortals, I hope this tutorial can show you the possibilities of using Frog's APIs and that it will encourage you to build your own resources.


* I'd love your feedback to improve this, to be honest

Link to comment
Share on other sites

Thanks Graham.  I must have a typo somewhere else then as I don't see anything in the console when this code runs.  

Most code examples on here use FrogOS.fdp, but this one uses Frog.Model.api.  Is one approach legacy or is one better than the other?

What is the difference between the HTML widget on a frog page and the new FrogCode that has appeared in my frogdrive?

Link to comment
Share on other sites

FrogOS.fdp uses the "set in stone" APIs for the Frog Developer Platform.   Frog.Model.api uses the internal APIs our developers uses.  There is a potential for these APIs to change.   Ideally you'd always use the FDP ones, but sometimes there isn't an API to get the job done.

The HTML widget means you have to know what you're doing with code.  FrogCode will allow you to build this code into a widget so non-technical staff can make use of features you build, without having to copy-and-paste code.

We're waiting on a hotfix (looking like end of May) at which point you'll be able to activate FrogCode.  in the meantime though, you can install the Office365 widget from the FrogCode area on the community and i'll be adding more soon.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By Graham Quince
      I thought I'd share this snippet more for reference than for a specific need, but it saves you have to work it out later.  It uses an FDP API (fixed so they will not be changed, unlike the internal APIs)
      This is example, it was needed to change the site's background and banner to match a student's house colours.  I know I could have set the CSS in Javascript, but pages load on demand and by rendering out the CSS, it is easy to adapt for all sites, or all pages etc...
      <div class="styling"></div> <script> var siteUUID = 'SITE_UUID', user = FrogOS ? FrogOS.getUser() : this.getUser(), styling = arguments[0].find('.styling'); houseColours = { 'House1': { background: 'rgba(0,255,0,1)', banner: 'file/resource/7E4864D720030D3DB0338F5280C6A104F3BB61EC80ADD2A4' }, 'House2': { background: 'rgba(255,0,0,1)', banner: 'file/resource/7E4864D720030D3DB0338F5280C6A104F3BB61EC80ADD2A4' }, 'House3': { background: 'rgba(255,255,0,1)', banner: 'file/resource/7E4864D720030D3DB0338F5280C6A104F3BB61EC80ADD2A4' }, 'House4': { background: 'rgba(0,0,255,1)', banner: 'file/resource/7E4864D720030D3DB0338F5280C6A104F3BB61EC80ADD2A4' } }; if (user.profile.type == 'admin' || user.profile.type == 'superuser') { user.uuid = 'STUDENT_UUID'; } FrogOS.fdp({ url: 'group/memberships', path: '/api/fdp/2/', data: { uuid: user.uuid } }).done(function(response) { var house = 'House1'; var groups = response.response; $.each(groups, function(index,group) { if (group.type == 'house') { house = group.name; } }); var background = houseColours[house].background, banner = houseColours[house].banner; styling.html( '<style>'+ 'div[data-site-uuid="'+siteUUID+'"] .ui-theme-mobilesmallbanner-bodyline {'+ 'background: '+background+' !important;'+ 'background: linear-gradient(180deg, '+background+' 0%, rgba(255,255,255,1) 20%) !important;'+ '}'+ 'div[data-site-uuid="'+siteUUID+'"] .ui-theme-mobilesmallbanner-container {'+ 'background-image: url('+banner+') !important;'+ '}'+ '</style>' ) }).fail(function(e) { // Report Error console.log("failed"); }); </script>  
    • By Sean_M
      Is there a bit of html I can add to a page to autoplay videos in the Media widget on page load?
      Many thanks
    • By Graham Quince
      Some of you have already spotted this tutorial, but we've just updated it to reflect feedback from schools.
      You can now use the same code 'hack' a menu to open external links, subpages and even sites
    • By K.Ermit
      I have been provided with this code from Linguascope, but it doesn't work in the HTML widget.   
      <script language="javascript" src="http://www.linguascope.com/link/login/linguascope_login250x250.js"></script> Can anyone help please?
    • By K.Ermit
      Every time I add in a text widget,, I have to resize the text, as it starts too small, is there a way of setting the size be default?
  • Create New...